Snakemaker在规则环境中安装R包:错误无法移动00LOCK权限被拒绝



我正在编写一个Snakemake管道,其中包含一个将运行R脚本的规则。这个规则有自己的环境,看起来是这样的:

channels:
- conda-forge
- r
- bioconda
dependencies:
- r-base = 4.1.1
- r-ggplot2 = 3.3.5
- r-biocmanager = 1.30.16

除了上面的包,我还需要ggbio,它可以安装biocmanager:

if(!require(ggbio, quietly=TRUE)){  # if the package is not there, install it
BiocManager::install("ggbio")
}

当通过Snakemake执行此规则时,最初一切正常,并且安装了ggbio包的大多数依赖项。然而,过了一段时间,我得到了以下错误:

...
** 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

错误似乎源于以下部分:

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

只有当我在Windows上从Ubuntu应用程序运行Snakemake时,我才会出现这个错误。如果我在服务器上运行它,它就会工作:

** 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)

服务器和本地的版本相同,即xml2的版本为1.3.3。我看到了与这个锁问题有关的其他问题(这里和这里(,其中大多数都建议这样做:

install.packages("Rcpp", dependencies = TRUE, INSTALL_opts = '--no-lock')

但这对我来说不起作用,因为该软件包没有安装install.packages()。在安装之前添加options("install.lock"=FALSE)也不起作用。此外,当我检查环境位置中的Rlibrary文件夹时,我看不到00LOCK目录。

有什么建议吗?还是这只是一个不容易修复的Windows问题?在Rstudio中运行分期付款代码确实有效,但我需要将包安装在conda环境中,而不是我的标准Rstudios库中。

显示的YAML不合格(通道顺序不正确(。但更重要的是,在Conda管理的R环境中安装Conda软件包以外的任何软件包通常都无法正常工作。幸运的是,所有Bioconductor包都在biocda通道上(通常带有bioconductor-前缀,全部小写(,因此,只要使用,一切都会很好

channels:
- conda-forge
- bioconda
- defaults
dependencies:
- r-base=4.1.1
- r-ggplot2=3.3.5
- bioconductor-ggbio

最新更新