paul-buerkner / brms

brms R package for Bayesian generalized multivariate non-linear multilevel models using Stan
https://paul-buerkner.github.io/brms/
GNU General Public License v2.0
1.28k stars 182 forks source link

class definition removed from ‘dbplyr’ #1356

Closed ASKurz closed 2 years ago

ASKurz commented 2 years ago

Since installing brms 2.17.3, I've noticed a new quirk that if I load brms before the tidyverse, I get an error.

library(brms)
library(tidyverse)
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 ‘tidyverse’:
 .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’

However, there is no such error if I start a fresh R session and load the two in the reverse order.

library(tidyverse)
library(brms)

Here's my sessionInfo().

sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
 [1] brms_2.17.3     Rcpp_1.0.8.3    forcats_0.5.1   stringr_1.4.0   dplyr_1.0.9     purrr_0.3.4    
 [7] readr_2.1.2     tidyr_1.2.0     tibble_3.1.7    ggplot2_3.3.6   tidyverse_1.3.1

loaded via a namespace (and not attached):
  [1] TH.data_1.1-1        colorspace_2.0-3     ellipsis_0.3.2       ggridges_0.5.3      
  [5] estimability_1.3     markdown_1.1         base64enc_0.1-3      fs_1.5.2            
  [9] rstudioapi_0.13      farver_2.1.0         rstan_2.26.11        DT_0.22             
 [13] fansi_1.0.3          mvtnorm_1.1-3        lubridate_1.8.0      xml2_1.3.3          
 [17] splines_4.2.0        bridgesampling_1.1-2 codetools_0.2-18     shinythemes_1.2.0   
 [21] bayesplot_1.9.0      jsonlite_1.8.0       broom_0.8.0          dbplyr_2.1.1        
 [25] shiny_1.7.1          compiler_4.2.0       httr_1.4.3           emmeans_1.7.3       
 [29] backports_1.4.1      assertthat_0.2.1     Matrix_1.4-1         fastmap_1.1.0       
 [33] cli_3.3.0            later_1.3.0          htmltools_0.5.2      prettyunits_1.1.1   
 [37] tools_4.2.0          igraph_1.3.1         coda_0.19-4          gtable_0.3.0        
 [41] glue_1.6.2           reshape2_1.4.4       posterior_1.2.1      V8_4.1.0            
 [45] cellranger_1.1.0     vctrs_0.4.1          nlme_3.1-157         crosstalk_1.2.0     
 [49] tensorA_0.36.2       ps_1.7.0             rvest_1.0.2          mime_0.12           
 [53] miniUI_0.1.1.1       lifecycle_1.0.1      gtools_3.9.2         MASS_7.3-56         
 [57] zoo_1.8-10           scales_1.2.0         colourpicker_1.1.1   hms_1.1.1           
 [61] promises_1.2.0.1     Brobdingnag_1.2-7    sandwich_3.0-1       parallel_4.2.0      
 [65] inline_0.3.19        shinystan_2.6.0      curl_4.3.2           gridExtra_2.3       
 [69] loo_2.5.1            StanHeaders_2.26.11  stringi_1.7.6        dygraphs_1.1.1.6    
 [73] checkmate_2.1.0      pkgbuild_1.3.1       rlang_1.0.2          pkgconfig_2.0.3     
 [77] matrixStats_0.62.0   distributional_0.3.0 lattice_0.20-45      rstantools_2.2.0    
 [81] htmlwidgets_1.5.4    tidyselect_1.1.2     processx_3.5.3       plyr_1.8.7          
 [85] magrittr_2.0.3       R6_2.5.1             generics_0.1.2       multcomp_1.4-19     
 [89] DBI_1.1.2            pillar_1.7.0         haven_2.5.0          withr_2.5.0         
 [93] xts_0.12.1           survival_3.3-1       abind_1.4-5          modelr_0.1.8        
 [97] crayon_1.5.1         utf8_1.2.2           tzdb_0.3.0           grid_4.2.0          
[101] readxl_1.4.0         callr_3.7.0          threejs_0.3.3        reprex_2.0.1        
[105] digest_0.6.29        xtable_1.8-4         httpuv_1.6.5         RcppParallel_5.1.5  
[109] stats4_4.2.0         munsell_0.5.0        shinyjs_2.1.0     
paul-buerkner commented 2 years ago

I think I have seen this error before (someone had posted it somewhere) but I don't really know what to you about it. Also, while it is triggered by loading brms, I do not see how it relates to anything specifically brms does. Does anyone have any idea whats going on?

munoztd0 commented 2 years ago

Same issue here, trying to found out. If anyone has any info I would be very interested.

paul-buerkner commented 2 years ago

is this issue resolved perhaps in the latest github releases of dbplyr?

David Muñoz Tord @.***> schrieb am Di., 17. Mai 2022, 11:37:

Same issue here, trying to found out. If anyone has any info I would be very interested.

— Reply to this email directly, view it on GitHub https://github.com/paul-buerkner/brms/issues/1356#issuecomment-1128646352, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADCW2ACR4PJZ4MNN2YD2GXTVKNSFLANCNFSM5V7SMLKQ . You are receiving this because you commented.Message ID: @.***>

eipi10 commented 2 years ago

I was having the same problem. Based on this dbplyr issue I reinstalled the Matrix package and that eliminated the error (though I have no idea what's causing the error or why reinstalling Matrix resolves it).

ASKurz commented 2 years ago

Reinstalling Matrix didn't work, on my end.

munoztd0 commented 2 years ago

Me neither

eipi10 commented 2 years ago

A few minutes ago I upgraded from brms 2.17.0 to 2.17.3 and the error came back. I reinstalled Matrix but it also did not work for me this time.

JBris commented 2 years ago

I just ran into the same issue. Reinstalling Matrix fixed it for me.

I'm using brms 2.17.0 too

ASKurz commented 2 years ago

For me, the issue didn't arise until I installed brms 2.17.3.

munoztd0 commented 2 years ago

Issue has been fixed, for more info check out tidyverse/dbplyr/issues/779 (well actually it is Brobdingnag which caused the bug which is a dependency from bridgsampling).

Just need to install dev version of Brobdingnag (>= 1.2-8) and reload.

devtools::install_github("RobinHankin/Brobdingnag")

paul-buerkner commented 2 years ago

Perfect! Thank you!

dputhier commented 1 year ago

Hi. I got the same issue:

    > library(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’

I have installed the latest Brobdingnag version:

            devtools::install_github("RobinHankin/Brobdingnag")

Restarted R:

          .rs.restartR()

Reinstalled dbplyr:

         install.packages('dbplyr')

But still got the issue:

    > library('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’

I also tried to install from github

             devtools::install_github("tidyverse/dbplyr")

But unfortunately got another error message

    > library('dbplyr')
    Error: package or namespace load failed for ‘dbplyr’ in get(Info[i, 1], envir = env):
     lazy-load database '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/dbplyr/R/dbplyr.rdb' is corrupt
    In addition: Warning message:
    In get(Info[i, 1], envir = env) : internal error -3 in R_decompress1

I deleted the '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/dbplyr'

            rm -rf /Library/Frameworks/R.framework/Versions/4.2/Resources/library/dbplyr

Re-installed the github version:

             .rs.restartR()
             devtools::install_github("tidyverse/dbplyr")

Whithout more success:

    > library('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’

Any hint ? Best

    > sessionInfo()
    R version 4.2.2 (2022-10-31)
    Platform: x86_64-apple-darwin17.0 (64-bit)
    Running under: macOS Monterey 12.5.1

    Matrix products: default
    LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

    locale:
    [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

    other attached packages:
    [1] Brobdingnag_1.2-9 Matrix_1.5-1     

    loaded via a namespace (and not attached):
      [1] Seurat_4.3.0           Rtsne_0.16             colorspace_2.1-0       deldir_1.0-6           gson_0.0.9            
      [6] ellipsis_0.3.2         ggridges_0.5.4         rprojroot_2.0.3        fs_1.6.1               rstudioapi_0.14       
     [11] spatstat.data_3.0-0    leiden_0.4.3           listenv_0.9.0          remotes_2.4.2          ggrepel_0.9.3         
     [16] fansi_1.0.4            codetools_0.2-18       splines_4.2.2          cachem_1.0.6           pkgload_1.3.2         
     [21] polyclip_1.10-4        jsonlite_1.8.4         ica_1.0-3              cluster_2.1.4          png_0.1-8             
     [26] uwot_0.1.14            shiny_1.7.4            sctransform_0.3.5      spatstat.sparse_3.0-0  compiler_4.2.2        
     [31] httr_1.4.4             SeuratObject_4.1.3     fastmap_1.1.0          lazyeval_0.2.2         cli_3.6.0             
     [36] later_1.3.0            prettyunits_1.1.1      htmltools_0.5.4        tools_4.2.2            igraph_1.4.0          
     [41] gtable_0.3.1           glue_1.6.2             RANN_2.6.1             reshape2_1.4.4         dplyr_1.1.0           
     [46] Rcpp_1.0.10            scattermore_0.8        Biobase_2.58.0         vctrs_0.5.2            spatstat.explore_3.0-6
     [51] nlme_3.1-160           progressr_0.13.0       lmtest_0.9-40          spatstat.random_3.1-3  stringr_1.5.0         
     [56] ps_1.7.2               globals_0.16.2         mime_0.12              miniUI_0.1.1.1         lifecycle_1.0.3       
     [61] irlba_2.3.5.1          devtools_2.4.5         goftest_1.2-3          future_1.31.0          MASS_7.3-58.1         
     [66] zoo_1.8-11             scales_1.2.1           promises_1.2.0.1       spatstat.utils_3.0-1   parallel_4.2.2        
     [71] SparseM_1.81           RColorBrewer_1.1-3     curl_5.0.0             memoise_2.0.1          reticulate_1.28       
     [76] pbapply_1.7-0          gridExtra_2.3          ggplot2_3.4.1          stringi_1.7.12         desc_1.4.2            
     [81] S4Vectors_0.36.1       BiocGenerics_0.44.0    pkgbuild_1.4.0         rlang_1.0.6            pkgconfig_2.0.3       
     [86] matrixStats_0.63.0     bitops_1.0-7           lattice_0.20-45        ROCR_1.0-11            purrr_1.0.1           
     [91] tensor_1.5             patchwork_1.1.2        htmlwidgets_1.6.1      processx_3.8.0         cowplot_1.1.1         
     [96] tidyselect_1.2.0       parallelly_1.34.0      RcppAnnoy_0.0.20       plyr_1.8.8             magrittr_2.0.3        
    [101] R6_2.5.1               profvis_0.3.7          generics_0.1.3         DBI_1.1.3              withr_2.5.0           
    [106] pillar_1.8.1           fitdistrplus_1.1-8     survival_3.4-0         abind_1.4-5            RCurl_1.98-1.10       
    [111] sp_1.6-0               tibble_3.1.8           future.apply_1.10.0    crayon_1.5.2           KernSmooth_2.23-20    
    [116] utf8_1.2.3             spatstat.geom_3.0-6    plotly_4.10.1          urlchecker_1.0.1       usethis_2.1.6         
    [121] grid_4.2.2             data.table_1.14.6      callr_3.7.3            digest_0.6.31          xtable_1.8-4          
    [126] tidyr_1.3.0            httpuv_1.6.8           stats4_4.2.2           munsell_0.5.0          viridisLite_0.4.1     
    [131] sessioninfo_1.2.2     
jingydz commented 1 year ago

image image I have tried to install Brobdingnag (>= 1.2-8) , Matrix, rbms and etc. But that still doesn't solve my problem.

cparsania commented 7 months ago

With Brobdingnag_1.2-9 still the same issue.