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

问题描述 投票:0回答:2

我用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之间存在这种差异?

Following Johannes Koester's comment, I have created a conda environment and installed bioconductor-rtracklayer without specifying the r channel:

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 bioconductor
2个回答
1
投票

没有必要将r通道与conda forge和bioconda混合使用。它们甚至是二进制不兼容的。来自r频道的所有套餐现在都是conda-forge。请参阅http://bioconda.github.io获取正确的渠道订单和组合。希望这可能已经解决了错误。


0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.