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

时间:2019-02-12 09:56:33

标签: r conda bioconductor

我创建了一个带有r和bioconductor-rtracklayer的conda环境:

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环境并安装了bioconductor-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')给了我同样的错误。

2 个答案:

答案 0 :(得分:1)

无需将r通道与conda forge和bioconda混合使用。它们甚至是二进制不兼容的。 r通道中的所有软件包现在都在conda-forge中。有关正确的频道顺序和组合,请参见http://bioconda.github.io。希望这可以解决错误。

答案 1 :(得分:0)

进入.bash_profile并删除R_LIBS_USER变量。现在正在工作。由约翰内斯·科斯特(Johannes Koester)建议。

相关问题