tidyverse / dbplyr

Database (DBI) backend for dplyr
https://dbplyr.tidyverse.org
Other
477 stars 173 forks source link

Error when install packages that loading dbplyr as the dependency #619

Closed albert-ying closed 3 years ago

albert-ying commented 3 years ago

I encountered a weird bug while installing packages with dbplyr as a dependency

Example 1: Tune package

install.packages("tune")
trying URL 'https://cran.microsoft.com/src/contrib/tune_0.1.3.tar.gz'
Content type 'application/octet-stream' length 1056081 bytes (1.0 MB)
==================================================
downloaded 1.0 MB

* installing *source* package ‘tune’ ...
** package ‘tune’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
Loading required package: dbplyr
Error in completeSubclasses(classDef2, class1, obj, where) :
  trying to get slot "subclasses" from an object of a basic class ("NULL") with no slots
Error: package or namespace load failed for ‘dbplyr’:
 .onLoad failed in loadNamespace() for 'dbplyr', details:
  call: setClass(cl, contains = c(prevClass, "VIRTUAL"), where = where)
  error: error in contained classes ("character") for class “ident”; class definition removed from ‘dbplyr’
Warning: namespace ‘recipes’ is not available and has been replaced
by .GlobalEnv when processing object ‘ames_wflow’
Loading required package: dbplyr
Error in completeSubclasses(classDef2, class1, obj, where) :
  trying to get slot "subclasses" from an object of a basic class ("NULL") with no slots
Error: package or namespace load failed for ‘dbplyr’:
 .onLoad failed in loadNamespace() for 'dbplyr', details:
  call: setClass(cl, contains = c(prevClass, "VIRTUAL"), where = where)
  error: error in contained classes ("character") for class “ident”; class definition removed from ‘dbplyr’
Warning: namespace ‘recipes’ is not available and has been replaced
by .GlobalEnv when processing object ‘ames_wflow’
** inst
** byte-compile and prepare package for lazy loading
Error in completeSubclasses(classDef2, class1, obj, where) :
  trying to get slot "subclasses" from an object of a basic class ("NULL") with no slots
Error: package or namespace load failed for ‘dbplyr’:
 .onLoad failed in loadNamespace() for 'dbplyr', details:
  call: setClass(cl, contains = c(prevClass, "VIRTUAL"), where = where)
  error: error in contained classes ("character") for class “ident”; class definition removed from ‘dbplyr’
Error in .requirePackage(package) :
  unable to find required package ‘dbplyr’
Calls: <Anonymous> ... .recacheSubclasses -> getClassDef -> .requirePackage
Execution halted
ERROR: lazy loading failed for package ‘tune’
* removing ‘/home/kying/R/x86_64-pc-linux-gnu-library/4.0/tune’

The downloaded source packages are in
    ‘/tmp/RtmpO11XE2/downloaded_packages’
Warning message:
In install.packages("tune") :
  installation of package ‘tune’ had non-zero exit status

Example 2: glmnet package

install.packages("glmnet")
Installing package into ‘/home/kying/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.microsoft.com/src/contrib/glmnet_4.1-1.tar.gz'
Content type 'application/octet-stream' length 2154483 bytes (2.1 MB)
==================================================
downloaded 2.1 MB

* installing *source* package ‘glmnet’ ...
** package ‘glmnet’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran  -fpic  -g -O2  -c glmnet5dpclean.f -o glmnet5dpclean.o
gcc -std=gnu99 -I"/home/kying/R/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c glmnet_init.c -o glmnet_init.o
gcc -std=gnu99 -I"/home/kying/R/lib/R/include" -DNDEBUG   -I/usr/local/include   -fpic  -g -O2  -c pb.c -o pb.o
gfortran  -fpic  -g -O2  -c wls.f -o wls.o
gcc -std=gnu99 -shared -L/home/kying/R/lib/R/lib -L/usr/local/lib -o glmnet.so glmnet5dpclean.o glmnet_init.o pb.o wls.o -L/usr/lib/gcc/x86_64-linux-gnu/5 -lgfortran -lm -lquadmath -L/home/kying/R/lib/R/lib -lR
installing to /home/kying/R/x86_64-pc-linux-gnu-library/4.0/00LOCK-glmnet/00new/glmnet/libs
** R
** data
** inst
** byte-compile and prepare package for lazy loading
Error in completeSubclasses(classDef2, class1, obj, where) :
  trying to get slot "subclasses" from an object of a basic class ("NULL") with no slots
Error: package or namespace load failed for ‘dbplyr’:
 .onLoad failed in loadNamespace() for 'dbplyr', details:
  call: setClass(cl, contains = c(prevClass, "VIRTUAL"), where = where)
  error: error in contained classes ("character") for class “ident”; class definition removed from ‘dbplyr’
Error: package or namespace load failed for ‘Matrix’ in .requirePackage(package):
 unable to find required package ‘dbplyr’
Error: package ‘Matrix’ could not be loaded
Execution halted
ERROR: lazy loading failed for package ‘glmnet’
* removing ‘/home/kying/R/x86_64-pc-linux-gnu-library/4.0/glmnet’
* restoring previous ‘/home/kying/R/x86_64-pc-linux-gnu-library/4.0/glmnet’

The downloaded source packages are in
    ‘/tmp/RtmpO11XE2/downloaded_packages’
Warning message:
In install.packages("glmnet") :
  installation of package ‘glmnet’ had non-zero exit status

dbplyr itself can be installed with no error

> install.packages("dbplyr")
Installing package into ‘/home/kying/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.microsoft.com/src/contrib/dbplyr_2.1.0.tar.gz'
Content type 'application/octet-stream' length 579687 bytes (566 KB)
==================================================
downloaded 566 KB

* installing *source* package ‘dbplyr’ ...
** package ‘dbplyr’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (dbplyr)

The downloaded source packages are in
    ‘/tmp/RtmpO11XE2/downloaded_packages’

Do you have any thoughts that what may cause this error? Thank you!

SessionInfo

R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS

Matrix products: default
BLAS:   /home/kying/R/lib/R/lib/libRblas.so
LAPACK: /home/kying/R/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_4.0.3 tools_4.0.3
albert-ying commented 3 years ago

Resolved by manually install the package "Matrix"

anikaliu commented 3 years ago

I'm having the same issue as mentioned above and wasn't able to solve this by installing and loading dbplyr and Matrix in advance. Do you have any suggestions on how to work around this?

Error in completeSubclasses(classDef2, class1, obj, where) : 
  trying to get slot "subclasses" from an object of a basic class ("NULL") with no slots
Error: package or namespace load failed for ‘dbplyr’:
 .onLoad failed in loadNamespace() for 'dbplyr', details:
  call: setClass(cl, contains = c(prevClass, "VIRTUAL"), where = where)
  error: error in contained classes ("character") for class “ident”; class definition removed from ‘dbplyr’
Error in .requirePackage(package) : 
  unable to find required package ‘dbplyr’
Calls: <Anonymous> ... .recacheSubclasses -> getClassDef -> .requirePackage
Execution halted
jamesdalg commented 2 years ago

I will affirm that this issue still occurs when using version 2.1.1.

> library(GenomicFeatures)
Loading required package: AnnotationDbi
Error in completeSubclasses(classDef2, class1, obj, where) : 
  trying to get slot "subclasses" from an object of a basic class ("NULL") with no slots
Error: package or namespace load failed for ‘GenomicFeatures’:
 .onLoad failed in loadNamespace() for 'dbplyr', details:
  call: setClass(cl, contains = c(prevClass, "VIRTUAL"), where = where)
  error: error in contained classes ("character") for class “ident”; class definition removed from ‘dbplyr’
> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                           LC_TIME=English_United States.1252    
system code page: 65001

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] InteractionSet_1.20.0       SummarizedExperiment_1.22.0 Biobase_2.52.0              MatrixGenerics_1.4.3        matrixStats_0.61.0          foreach_1.5.2               parallelsugar_0.0.0.2      
 [8] gUtils_0.2.0                data.table_1.14.2           GenomicRanges_1.44.0        GenomeInfoDb_1.28.4         IRanges_2.26.0              S4Vectors_0.30.2            BiocGenerics_0.38.0        
[15] magrittr_2.0.2             

loaded via a namespace (and not attached):
  [1] utf8_1.2.2               proto_1.0.0              tidyselect_1.1.1         lme4_1.1-28              RSQLite_2.2.9            AnnotationDbi_1.54.1     htmlwidgets_1.5.4        grid_4.1.2              
  [9] BiocParallel_1.26.2      ggtern_3.3.5             munsell_0.5.0            codetools_0.2-18         DT_0.20                  miniUI_0.1.1.1           Brobdingnag_1.2-7        colorspace_2.0-2        
 [17] knitr_1.37               rstudioapi_0.13          robustbase_0.93-9        bayesm_3.1-4             brms_2.16.3              bayesplot_1.8.1          rstan_2.21.3             repr_1.1.4              
 [25] GenomeInfoDbData_1.2.6   bit64_4.0.5              farver_2.1.0             bridgesampling_1.1-2     coda_0.19-4              vctrs_0.3.8              generics_0.1.2           xfun_0.29               
 [33] R6_2.5.1                 markdown_1.1             doParallel_1.0.17        gamm4_0.2-6              projpred_2.0.2           bitops_1.0-7             cachem_1.0.6             DelayedArray_0.18.0     
 [41] assertthat_0.2.1         promises_1.2.0.1         BiocIO_1.2.0             scales_1.1.1             gtable_0.3.0             processx_3.5.2           rlang_1.0.1              splines_4.1.2           
 [49] rtracklayer_1.52.1       checkmate_2.0.0          inline_0.3.19            yaml_2.2.2               reshape2_1.4.4           abind_1.4-5              threejs_0.3.3            crosstalk_1.2.0         
 [57] backports_1.4.1          httpuv_1.6.5             rsconnect_0.8.25         tensorA_0.36.2           tools_4.1.2              ggplot2_3.3.5            ellipsis_0.3.2           posterior_1.2.0         
 [65] ggridges_0.5.3           latex2exp_0.9.3          Rcpp_1.0.8               plyr_1.8.6               base64enc_0.1-3          progress_1.2.2           zlibbioc_1.38.0          purrr_0.3.4             
 [73] RCurl_1.98-1.6           ps_1.6.0                 prettyunits_1.1.1        zoo_1.8-9                ggrepel_0.9.1            colourpicker_1.1.1       mvtnorm_1.1-3            hms_1.1.1               
 [81] shinyjs_2.1.0            mime_0.12                xtable_1.8-4             shinystan_2.5.0          XML_3.99-0.8             gridExtra_2.3            rstantools_2.1.1         compiler_4.1.2          
 [89] tibble_3.1.6             crayon_1.4.2             minqa_1.2.4              StanHeaders_2.21.0-7     htmltools_0.5.2          mgcv_1.8-38              later_1.3.0              tidyr_1.2.0             
 [97] RcppParallel_5.1.5       DBI_1.1.2                MASS_7.3-55              boot_1.3-28              compositions_2.0-4       Matrix_1.4-0             cli_3.1.1                igraph_1.2.11           
[105] forcats_0.5.1            pkgconfig_2.0.3          GenomicAlignments_1.28.0 skimr_2.1.3              dygraphs_1.1.1.6         XVector_0.32.0           stringr_1.4.0            distributional_0.3.0    
[113] callr_3.7.0              digest_0.6.29            Biostrings_2.60.2        restfulr_0.0.13          shiny_1.7.1              Rsamtools_2.8.0          gtools_3.9.2             rjson_0.2.21            
[121] nloptr_2.0.0             lifecycle_1.0.1          nlme_3.1-155             jsonlite_1.7.3           BSgenome_1.60.0          fansi_1.0.2              pillar_1.7.0             lattice_0.20-45         
[129] loo_2.4.1                KEGGREST_1.32.0          fastmap_1.1.0            httr_1.4.2               DEoptimR_1.0-10          pkgbuild_1.3.1           glue_1.6.1               xts_0.12.1              
[137] png_0.1-7                shinythemes_1.2.0        iterators_1.0.14         bit_4.0.4                stringi_1.7.6            blob_1.2.2               memoise_2.0.1            dplyr_1.0.8             
> 
Gbighe commented 1 year ago

I found a solution for this error, I got this error when I install R package monocle3, and I just set dbplyr as auto-library packages then the error was solved.

aeynaud commented 1 year ago

@Gbighe what do you mean by

set ` dbplyr' as auto-library packages?

I am encountering the same issue now when using library(meshes).

Shashankti commented 1 year ago

I found a solution for this error, I got this error when I install R package monocle3, and I just set dbplyr as auto-library packages then the error was solved.

Hey , I have been searching everywhere and I think you are one of the few people who found a solution to this issue, however I do not understand what you mean by setting dbplyr as auto-library. Could you please explain your method?

ChiaraCampanelli commented 1 year ago

I found a solution for this error, I got this error when I install R package monocle3, and I just set dbplyr as auto-library packages then the error was solved.

Hey , I have been searching everywhere and I think you are one of the few people who found a solution to this issue, however I do not understand what you mean by setting dbplyr as auto-library. Could you please explain your method?

I am trying to solve this problem too. I think it is related to monocle3 as @Gbighe suggested but I still don't understand what he means by ' setting as auto-library'

Gbighe commented 1 year ago

@Gbighe what do you mean by

set ` dbplyr' as auto-library packages?

I am encountering the same issue now when using .library(meshes)

To set dbplyr as an auto-loaded package in R, you can add it to your .Rprofile file. The .Rprofile file is a script that is automatically executed when you start an R session. Here's how you can do it:

Locate or create your .Rprofile file. The file is typically located in your home directory. If you can't find it, you can create a new one by running the following command in R:

file.edit("~/.Rprofile")

Once you have the .Rprofile file open, add the following line to it:

library(dbplyr)

Save the file and close it. Now, whenever you start an R session, dbplyr will be automatically loaded and available for use. You can test it by starting a new R session or by running library(dbplyr) to confirm that the package is loaded without explicitly calling the library() function.

Gbighe commented 1 year ago

I found a solution for this error, I got this error when I install R package monocle3, and I just set dbplyr as auto-library packages then the error was solved.

Hey , I have been searching everywhere and I think you are one of the few people who found a solution to this issue, however I do not understand what you mean by setting dbplyr as auto-library. Could you please explain your method?

Hi, Please find the method I used above. If you are using RStudio Server, the steps may vary. :-)

Gbighe commented 1 year ago

I found a solution for this error, I got this error when I install R package monocle3, and I just set dbplyr as auto-library packages then the error was solved.

Hey , I have been searching everywhere and I think you are one of the few people who found a solution to this issue, however I do not understand what you mean by setting dbplyr as auto-library. Could you please explain your method?

I am trying to solve this problem too. I think it is related to monocle3 as @Gbighe suggested but I still don't understand what he means by ' setting as auto-library'

Hi, Please find the method I used above. If you are using RStudio Server, the steps may vary. :-)

QifengOu commented 1 year ago

@Gbighe Thank you for the solution. it is a very good method.

erzakiev commented 1 year ago

@Gbighe suprisingly, your method works. But... wtf??

mansi-aggarwal-2504 commented 10 months ago

Thanks @Gbighe, your solution worked! 😀

BitterWood commented 9 months ago

@Gbighe Thanks so much. I almost went mad these days.

lexie-lee commented 1 month ago

Mine problem solved too, this is so exciting.

@Gbighe what do you mean by

set ` dbplyr' as auto-library packages?

I am encountering the same issue now when using .library(meshes)

To set dbplyr as an auto-loaded package in R, you can add it to your .Rprofile file. The .Rprofile file is a script that is automatically executed when you start an R session. Here's how you can do it:

Locate or create your .Rprofile file. The file is typically located in your home directory. If you can't find it, you can create a new one by running the following command in R:

file.edit("~/.Rprofile")

Once you have the .Rprofile file open, add the following line to it:

library(dbplyr)

Save the file and close it. Now, whenever you start an R session, dbplyr will be automatically loaded and available for use. You can test it by starting a new R session or by running library(dbplyr) to confirm that the package is loaded without explicitly calling the library() function.