Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RStudio/BiocParallel warning cause execution to crash #91

Closed
yonbar opened this issue Dec 6, 2023 · 4 comments
Closed

RStudio/BiocParallel warning cause execution to crash #91

yonbar opened this issue Dec 6, 2023 · 4 comments

Comments

@yonbar
Copy link

yonbar commented Dec 6, 2023

RStudio has a known issue that produces warnings when running a parallel process, which can be read here or here or here.
When attempting fitExtractVarPartModel() / dream() with parallel process, this causes an exception:

library("variancePartition")
data(varPartData)
form <- ~ Age + (1 | Individual) + (1 | Tissue) + (1 | Batch)
varPart <- fitExtractVarPartModel(geneExpr, form, info, BPPARAM = SnowParam(4))

The exception (might be a different package, other than stats):

Error in serialize(data, node$con) : 
  (converted from warning) 'package:stats' may not be available when loading
Error in serialize(data, node$con) : error writing to connection

The exception is thrown as run_lmm() sets the warning level to 2:

# catch warnings like errors, then reset to original value
optValue <- getOption("warn")
options(warn = 2)
on.exit(options(warn = optValue))

Of course, the problem stems from RStudio/BiocParallel and not from variancePartition, but still - terminating the execution due to a warning might be a bit harsh, and in addition - users might not be aware that variancePartition code terminates upon a warning.

In the mean time, there is a simple walkaround, using BPPARAM = SnowParam(exportglobals = F)

@GabrielHoffman
Copy link
Owner

Can you show sessionInfo()

@yonbar
Copy link
Author

yonbar commented Dec 6, 2023

R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8    LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/New_York
tzcode source: internal

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

other attached packages:
[1] variancePartition_1.32.2 BiocParallel_1.36.0      limma_3.58.1             ggplot2_3.4.4           

loaded via a namespace (and not attached):
 [1] gtable_0.3.4        caTools_1.18.2      Biobase_2.62.0      lattice_0.22-5      numDeriv_2016.8-1.1 vctrs_0.6.5         tools_4.3.2         Rdpack_2.6          bitops_1.0-7       
[10] generics_0.1.3      parallel_4.3.2      pbkrtest_0.5.2      tibble_3.2.1        fansi_1.0.5         pkgconfig_2.0.3     Matrix_1.6-4        KernSmooth_2.23-22  lifecycle_1.0.4    
[19] stringr_1.5.1       compiler_4.3.2      gplots_3.1.3        statmod_1.5.0       munsell_0.5.0       RhpcBLASctl_0.23-42 codetools_0.2-19    lmerTest_3.1-3      snow_0.4-4         
[28] pillar_1.9.0        nloptr_2.0.3        tidyr_1.3.0         MASS_7.3-60         aod_1.3.2           iterators_1.0.14    boot_1.3-28.1       nlme_3.1-164        gtools_3.9.5       
[37] tidyselect_1.2.0    stringi_1.8.2       fANCOVA_0.6-1       mvtnorm_1.2-4       dplyr_1.1.4         reshape2_1.4.4      purrr_1.0.2         splines_4.3.2       grid_4.3.2         
[46] colorspace_2.1-0    cli_3.6.1           magrittr_2.0.3      utf8_1.2.4          broom_1.0.5         corpcor_1.6.10      withr_2.5.2         scales_1.3.0        backports_1.4.1    
[55] remaCor_0.0.16      matrixStats_1.1.0   lme4_1.1-35.1       rbibutils_2.2.16    EnvStats_2.8.1      rlang_1.1.2         Rcpp_1.0.11         glue_1.6.2          BiocGenerics_0.48.1
[64] rstudioapi_0.15.0   minqa_1.2.6         plyr_1.8.9          R6_2.5.1      

Edit: The issue was closed by mistake

@yonbar yonbar closed this as completed Dec 6, 2023
@yonbar yonbar reopened this Dec 6, 2023
@GabrielHoffman
Copy link
Owner

I'm working on a fix

@GabrielHoffman
Copy link
Owner

Thanks for the bug report and the fix. I now set exportglobals <- FALSE internally to address this, so the standard code will work on windows now:

library("variancePartition")
data(varPartData)
form <- ~ Age + (1 | Individual) + (1 | Tissue) + (1 | Batch)
varPart <- fitExtractVarPartModel(geneExpr, form, info, BPPARAM = SnowParam(4))

See v1.33.4 from devtools::install_github("GabrielHoffman/variancePartition")

I will push this to the BioC release branch

Best,
Gabriel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants