在conda环境中将rtracklayer包从Bioconductor加载到R时,未映射分段故障和内存



我已经创建了一个conda环境,其中包含r和生物导管rtracklayer:

conda create --name bioconductor-rtracklayer --channel conda-forge --channel bioconda --channel r --yes r=3.5.1 bioconductor-rtracklayer=1.42.1

并激活它:

conda activate bioconductor-rtracklayer

我正在开发macOS High Sierra 10.13.3

然后我在终端中打开R并键入:

library(rtracklayer)

并得到以下错误:

Loading required package: GenomicRanges
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: ‘BiocGenerics’
The following objects are masked from ‘package:parallel’:
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from ‘package:stats’:
IQR, mad, sd, var, xtabs
The following objects are masked from ‘package:base’:
anyDuplicated, append, as.data.frame, basename, cbind, colMeans,
colnames, colSums, dirname, do.call, duplicated, eval, evalq,
Filter, Find, get, grep, grepl, intersect, is.unsorted, lapply,
lengths, Map, mapply, match, mget, order, paste, pmax, pmax.int,
pmin, pmin.int, Position, rank, rbind, Reduce, rowMeans, rownames,
rowSums, sapply, setdiff, sort, table, tapply, union, unique,
unsplit, which, which.max, which.min
Loading required package: S4Vectors
*** caught segfault ***
address 0x18, cause 'memory not mapped'
Traceback:
1: dyn.load(file, DLLpath = DLLpath, ...)
2: library.dynam(lib, package, package.lib)
3: loadNamespace(package, lib.loc)
4: doTryCatch(return(expr), name, parentenv, handler)
5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
6: tryCatchList(expr, classes, parentenv, handlers)
7: tryCatch({    attr(package, "LibPath") <- which.lib.loc    ns <- loadNamespace(package, lib.loc)    env <- attachNamespace(ns, pos = pos, deps)}, error = function(e) {    P <- if (!is.null(cc <- conditionCall(e)))         paste(" in", deparse(cc)[1L])    else ""    msg <- gettextf("package or namespace load failed for %s%s:n %s",         sQuote(package), P, conditionMessage(e))    if (logical.return)         message(paste("Error:", msg), domain = NA)    else stop(msg, call. = FALSE, domain = NA)})
8: library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc,     quietly = quietly)
9: .getRequiredPackages2(pkgInfo, quietly = quietly)
10: library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc,     quietly = quietly)
11: .getRequiredPackages2(pkgInfo, quietly = quietly)
12: library(rtracklayer)
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:

我不明白问题出在哪里。能请人帮帮我吗?

请注意,我可以在RStudio中运行library(rtracklayer),没有任何问题,并且我可以成功地使用包中的函数。为什么命令行和RStudio之间存在这种差异?

根据Johannes Koester的评论,我创建了一个conda环境,并安装了生物导管rtracklayer,但没有指定r通道:

conda create --name bioconductor-rtracklayer --channel conda-forge --channel bioconda --yes r=3.5.1 bioconductor-rtracklayer=1.42.1

激活环境,在终端中打开R并键入library(rtracklayer),但我仍然得到以下错误:

Loading required package: GenomicRanges
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: ‘BiocGenerics’
The following objects are masked from ‘package:parallel’:
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from ‘package:stats’:
IQR, mad, sd, var, xtabs
The following objects are masked from ‘package:base’:
anyDuplicated, append, as.data.frame, basename, cbind, colMeans,
colnames, colSums, dirname, do.call, duplicated, eval, evalq,
Filter, Find, get, grep, grepl, intersect, is.unsorted, lapply,
lengths, Map, mapply, match, mget, order, paste, pmax, pmax.int,
pmin, pmin.int, Position, rank, rbind, Reduce, rowMeans, rownames,
rowSums, sapply, setdiff, sort, table, tapply, union, unique,
unsplit, which, which.max, which.min
Loading required package: S4Vectors
*** caught segfault ***
address 0x18, cause 'memory not mapped'
Traceback:
1: dyn.load(file, DLLpath = DLLpath, ...)
2: library.dynam(lib, package, package.lib)
3: loadNamespace(package, lib.loc)
4: doTryCatch(return(expr), name, parentenv, handler)
5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
6: tryCatchList(expr, classes, parentenv, handlers)
7: tryCatch({    attr(package, "LibPath") <- which.lib.loc    ns <- loadNamespace(package, lib.loc)    env <- attachNamespace(ns, pos = pos, deps)}, error = function(e) {    P <- if (!is.null(cc <- conditionCall(e)))         paste(" in", deparse(cc)[1L])    else ""    msg <- gettextf("package or namespace load failed for %s%s:n %s",         sQuote(package), P, conditionMessage(e))    if (logical.return)         message(paste("Error:", msg), domain = NA)    else stop(msg, call. = FALSE, domain = NA)})
8: library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc,     quietly = quietly)
9: .getRequiredPackages2(pkgInfo, quietly = quietly)
10: library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc,     quietly = quietly)
11: .getRequiredPackages2(pkgInfo, quietly = quietly)
12: library(rtracklayer)
Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: 1
R is aborting now ...
[1]    44550 segmentation fault  R

请注意,我的.libPaths()包含:

.libPaths()
[1] "/Users/user/Library/R/3.5/library"
[2] "/Users/user/anaconda/envs/bioconductor-rtracklayer/lib/R/library"

我应该删除.libPaths()中R的第一行,以便在conda环境中获取R包吗?

然而,library(rtracklayer, lib.loc = '/Users/user/anaconda/envs/bioconductor-rtracklayer/lib/R/library')给了我同样的错误。

无需将r通道与conda-forge和bioda混合。它们甚至是二进制不兼容的。来自r通道的所有包现在都在conda锻造中。请参阅http://bioconda.github.io用于正确的通道顺序和组合。希望这可能已经解决了错误。

进入.bash_profile并删除R_LIBS_USER变量。它现在起作用了。Johannes Koester建议。

最新更新