NYU-Molecular-Pathology / NGS580-nf

Target exome sequencing analysis for NYU NGS580 gene panel
GNU General Public License v3.0
10 stars 6 forks source link

R installed in home dir breaks Singularity containers #43

Open varshini712 opened 4 years ago

varshini712 commented 4 years ago

We recently had errors with the deconstructSigs Singularity container deconstructSigs-1.8.0.simg:

Loading required package: GenomicRanges
Error: package or namespace load failed for ‘GenomicRanges’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 namespace ‘XVector’ 0.18.0 is being loaded, but >= 0.19.8 is required
Error: package ‘GenomicRanges’ could not be loaded
Execution halted

It turns out that R was discovering two installations of the XVector library:

> installed.packages()[c(41, 117),]
        Package   LibPath
XVector "XVector" "/gpfs/home/vasudv02/R/x86_64-pc-linux-gnu-library/3.4"
XVector "XVector" "/conda/lib/R/library"
        Version  Priority
XVector "0.18.0" NA
XVector "0.20.0" NA
        Depends
XVector "R (>= 2.8.0), methods, BiocGenerics (>= 0.19.2), S4Vectors (>=\n0.15.14), IRanges (>= 2.9.18)"
XVector "R (>= 2.8.0), methods, BiocGenerics (>= 0.19.2), S4Vectors (>=\n0.17.24), IRanges (>= 2.13.16)"
        Imports
XVector "methods, zlibbioc, BiocGenerics, S4Vectors, IRanges"
XVector "methods, utils, zlibbioc, BiocGenerics, S4Vectors, IRanges"
        LinkingTo            Suggests                              Enhances
XVector "S4Vectors, IRanges" "Biostrings, drosophila2probe, RUnit" NA
XVector "S4Vectors, IRanges" "Biostrings, drosophila2probe, RUnit" NA
        License        License_is_FOSS License_restricts_use OS_type MD5sum
XVector "Artistic-2.0" NA              NA                    NA      NA
XVector "Artistic-2.0" NA              NA                    NA      NA
        NeedsCompilation Built
XVector "yes"            "3.4.2"
XVector "yes"            "3.4.1"

The version 0.18.0 of the library was in the user home directory /gpfs/home/vasudv02/R/x86_64-pc-linux-gnu-library/3.4. This conflicted with the conda-installed version 0.20.0 that was meant to be used inside the container, causing the error shown.

The solution in this case was to remove the user installation directory for R. However, it is expected that any user with an R installation that happens to coincide with the version of R inside the container might end up with the same problem. We need to figure out a way to prevent user home directory R installed libraries from being used inside Singularity containers. Note that by default, Singularity mounts the user's home directory inside the container, and by default R will look for libraries in the user home directory. So we might need to figure out if its possible to disable this feature or find some other work-around.

stevekm commented 4 years ago

There might be some R environment variables that you could set in order to prevent it from picking up the user home dir for libraries. However that would require rebuilding the images which is also having issues.

stevekm commented 4 years ago

There are some commands you can use within R to dictate where libraries get loaded from but I'm not sure if those changes are permanent, they might just be for that single R session