cmu-delphi / epipredict

Tools for building predictive models in epidemiology.
https://cmu-delphi.github.io/epipredict/
Other
8 stars 9 forks source link

`undefined subclass` warning when `load_all`-ing under some conditions #157

Open brookslogan opened 1 year ago

brookslogan commented 1 year ago

Summary:

Comments:

Exploration:

Trying to load epipredict gives a weird message:

devtools::load_all(export_all = FALSE)
#> ℹ Loading epipredict
#> Loading required package: epiprocess
#> 
#> Attaching package: ‘epiprocess’
#> 
#> The following object is masked from ‘package:stats’:
#> 
#>     filter
#> 
#> Loading required package: parsnip
#> Warning message:
#> In .recacheSubclasses(def@className, def, env) :
#>   undefined subclass "numericVector" of class "Mnumeric"; definition not updated

Fresh session, same(!!) renv; somehow options(warn=2L) alters the operation!

devtools::load_all(export_all = FALSE)
#> ℹ Loading epipredict
#> Loading required package: epiprocess
#> 
#> Attaching package: ‘epiprocess’
#> 
#> The following object is masked from ‘package:stats’:
#> 
#>     filter
#> 
#> Loading required package: parsnip
#> ℹ The package `quantreg` is required.
#> ✖ Would you like to install it?
#> 
#> 1: Yes
#> 2: No

Fresh session, after saying Yes above (--> renv.lock.2.as.txt): success! No warning.

devtools::load_all(export_all = FALSE)
#> 
#> ℹ Loading epipredict
#> Loading required package: epiprocess
#> 
#> Attaching package: ‘epiprocess’
#> 
#> The following object is masked from ‘package:stats’:
#> 
#>     filter
#> 
#> Loading required package: parsnip

Fresh session, after reverting the renv.lock back to its initial state and renv::restore()-ing: also no warning somehow?! (though renv said something suspicious like * The library is already synchronized with the lockfile. when I tried to use it to do the reversion)

devtools::load_all('~/files/tooling/epipredict')
#> ℹ Loading epipredict
#> Loading required package: epiprocess
#> 
#> Attaching package: ‘epiprocess’
#> 
#> The following object is masked from ‘package:stats’:
#> 
#>     filter
#> 
#> Loading required package: parsnip
sessionInfo() # a bit too late as I can no longer reproduce
#> R version 4.1.3 (2022-03-10)
#> Platform: x86_64-redhat-linux-gnu (64-bit)
#> Running under: Fedora Linux 36 (Workstation Edition)
#> 
#> Matrix products: default
#> BLAS/LAPACK: /usr/lib64/libflexiblas.so.3.2
#> 
#> 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 datasets  utils     methods   base     
#> 
#> other attached packages:
#> [1] epipredict_0.0.3.9999 testthat_3.1.4        parsnip_1.0.3        
#> [4] epiprocess_0.5.0.9999
#> 
#> loaded via a namespace (and not attached):
#>  [1] fs_1.5.2             usethis_2.1.6        lubridate_1.9.0     
#>  [4] devtools_2.4.4       rprojroot_2.0.3      tools_4.1.3         
#>  [7] profvis_0.3.7        utf8_1.2.2           R6_2.5.1            
#> [10] rpart_4.1.16         DBI_1.1.3            colorspace_2.0-3    
#> [13] nnet_7.3-17          urlchecker_1.0.1     withr_2.5.0         
#> [16] tidyselect_1.2.0     prettyunits_1.1.1    processx_3.7.0      
#> [19] compiler_4.1.3       cli_3.5.0            quantreg_5.94       
#> [22] SparseM_1.81         desc_1.4.2           scales_1.2.1        
#> [25] callr_3.7.1          stringr_1.4.1        digest_0.6.30       
#> [28] tsibble_1.1.1        pkgconfig_2.0.3      htmltools_0.5.3     
#> [31] parallelly_1.32.1    sessioninfo_1.2.2    fastmap_1.1.0       
#> [34] htmlwidgets_1.5.4    rlang_1.0.6          rstudioapi_0.13     
#> [37] shiny_1.7.2          farver_2.1.1         generics_0.1.3      
#> [40] dplyr_1.0.10         distributional_0.3.0 magrittr_2.0.3      
#> [43] Matrix_1.5-3         Rcpp_1.0.9           munsell_0.5.0       
#> [46] fansi_1.0.3          lifecycle_1.0.3      stringi_1.7.8       
#> [49] brio_1.1.3           MASS_7.3-58.1        pkgbuild_1.3.1      
#> [52] recipes_1.0.1        grid_4.1.3           parallel_4.1.3      
#> [55] listenv_0.8.0        promises_1.2.0.1     crayon_1.5.2        
#> [58] miniUI_0.1.1.1       lattice_0.20-45      splines_4.1.3       
#> [61] anytime_0.3.9        ps_1.7.1             pillar_1.8.1        
#> [64] future.apply_1.9.0   codetools_0.2-18     pkgload_1.3.1       
#> [67] glue_1.6.2           data.table_1.14.6    remotes_2.4.2       
#> [70] renv_0.15.5          vctrs_0.5.1          httpuv_1.6.5        
#> [73] MatrixModels_0.5-1   gtable_0.3.1         purrr_1.0.0         
#> [76] tidyr_1.2.1          future_1.27.0        assertthat_0.2.1    
#> [79] cachem_1.0.6         ggplot2_3.4.0        gower_1.0.0         
#> [82] mime_0.12            prodlim_2019.11.13   xtable_1.8-4        
#> [85] later_1.3.0          class_7.3-20         survival_3.2-13     
#> [88] timeDate_4021.104    tibble_3.1.8         memoise_2.0.1       
#> [91] hardhat_1.2.0        lava_1.6.10          workflows_1.0.0     
#> [94] timechange_0.1.1     globals_0.16.2       ellipsis_0.3.2      
#> [97] ipred_0.9-13        

[Erroneously copy-pasted content removed.]

dajmcdon commented 1 year ago

Possible fixes may be updating R or parsnip. Both are behind mine by a bit, and I've never seen this warning. Maybe a linux thing?

brookslogan commented 1 year ago

Upgrading parsnip did not help. I didn't try upgrading R. Key problem seems to have been using some MatrixModels version 0.5-0 tucked away somewhere; upgrading to version 0.5-1 resolves. I think there's probably some devtools and/or renv and/or quantreg/parsnip DESCRIPTION suboptimalities somewhere in the mix here. We can prevent with a simple update to epipredict's DESCRIPTION. Will PR.