I'm writing a Snakemake pipeline with a rule that will run an R script. This rule has its own environment that looks like this:
channels:
- conda-forge
- r
- bioconda
dependencies:
- r-base = 4.1.1
- r-ggplot2 = 3.3.5
- r-biocmanager = 1.30.16
Next to the above packages, I also need ggbio, which can be installed with biocmanager
:
if(!require(ggbio, quietly=TRUE)){ # if the package is not there, install it
BiocManager::install("ggbio")
}
When executing this rule via Snakemake, initially everything goes right, and most dependencies of the ggbio
package get installed. However, after some while, I get the following error:
...
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
mv: cannot move '/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/00LOCK-xml2/00new/xml2' to '/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/xml2': Permission denied
ERROR: moving to final location failed
ERROR: dependency ‘xml2’ is not available for package ‘biomaRt’
* removing ‘/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/biomaRt’
ERROR: dependency ‘biomaRt’ is not available for package ‘GenomicFeatures’
* removing ‘/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/GenomicFeatures’
ERROR: dependency ‘GenomicFeatures’ is not available for package ‘VariantAnnotation’
* removing ‘/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/VariantAnnotation’
ERROR: dependency ‘GenomicFeatures’ is not available for package ‘OrganismDbi’
* removing ‘/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/OrganismDbi’
ERROR: dependency ‘GenomicFeatures’ is not available for package ‘ensembldb’
* removing ‘/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/ensembldb’
ERROR: dependencies ‘GenomicFeatures’, ‘VariantAnnotation’, ‘ensembldb’ are not available for package ‘biovizBase’
* removing ‘/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/biovizBase’
ERROR: dependencies ‘biovizBase’, ‘VariantAnnotation’, ‘GenomicFeatures’, ‘OrganismDbi’, ‘ensembldb’ are not available for package ‘ggbio’
* removing ‘/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/ggbio’
The downloaded source packages are in
‘/tmp/RtmpiQdboR/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Old packages: 'fansi'
Warning messages:
1: In .inet_warning(msg) :
installation of package ‘xml2’ had non-zero exit status
2: In .inet_warning(msg) :
installation of package ‘biomaRt’ had non-zero exit status
3: In .inet_warning(msg) :
installation of package ‘GenomicFeatures’ had non-zero exit status
4: In .inet_warning(msg) :
installation of package ‘VariantAnnotation’ had non-zero exit status
5: In .inet_warning(msg) :
installation of package ‘OrganismDbi’ had non-zero exit status
6: In .inet_warning(msg) :
installation of package ‘ensembldb’ had non-zero exit status
7: In .inet_warning(msg) :
installation of package ‘biovizBase’ had non-zero exit status
8: In .inet_warning(msg) :
installation of package ‘ggbio’ had non-zero exit status
Error in library(ggbio) : there is no package called ‘ggbio’
Execution halted
The error seems to originate from this part:
mv: cannot move '/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/00LOCK-xml2/00new/xml2' to '/mnt/c/Users/nicks/Documents/variantcallingpipeline/.snakemake/conda/b98e3353bb11024e3652b19a833d9dc8/lib/R/library/xml2': Permission denied
I get this error only when I run Snakemake from the Ubuntu app on my Windows. If I run it on the server, it works:
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (xml2)
... (and then it continues to the other packages)
The versions are the same on the server and local, which is 1.3.3
for xml2
. I've seen other questions relating to this lock issue (here and here), and most of them suggest doing something like this:
install.packages("Rcpp", dependencies = TRUE, INSTALL_opts = '--no-lock')
But this doesn't work for me because the package doesn't get installed with install.packages()
. Adding options("install.lock"=FALSE)
before the install also doesn't work. Also, when I check the R library
folder in the environment location, I do not see the 00LOCK
directory.
Any tips? Or is this just a Windows thing that's not easily fixable? Running the installment code in Rstudio does work, but I need the package to get installed in the conda environment, not my standard Rstudio library.