安装 R 包时出错:使用 Anaconda 扫描

Error installing R package: scran using Anaconda

我正在使用 anaconda 下载名为 scran 的 R 包。虽然我已经将它下载到我的 R 库路径,但我收到了错误。当我尝试在我的 R 环境中加载我的包时,它也失败了。我在 macOS Catalina (10.15.4) 上。我也试过BiocManager::install(scran),但也失败了。

scran (https://bioconductor.org/packages/release/bioc/html/scran.html)

有人可以帮帮我吗?非常感谢!请参阅下面的详细信息。

# 我使用 conda install -c Bioconda bioconductor-scran

下载 scran
(scrnaseq) yaochung41@x86_64-apple-darwin13 library % conda install -c bioconda bioconductor-scran
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /Users/yaochung41/anaconda3/envs/scrnaseq

  added / updated specs:
    - bioconductor-scran


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2020.4.5.1 |       hecc5488_0         146 KB  conda-forge
    certifi-2020.4.5.1         |   py38h32f6830_0         151 KB  conda-forge
    ------------------------------------------------------------
                                           Total:         297 KB

The following packages will be UPDATED:

  bioconductor-scran bioconda/label/cf201901::bioconductor~ --> bioconda::bioconductor-scran-1.14.1-r36h6de7cb9_0
  ca-certificates                     2019.11.28-hecc5488_0 --> 2020.4.5.1-hecc5488_0
  certifi                         2019.11.28-py38h32f6830_1 --> 2020.4.5.1-py38h32f6830_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
ca-certificates-2020 | 146 KB    | ##################################### | 100% 
certifi-2020.4.5.1   | 151 KB    | ##################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
INFO: deactivate-gfortran_osx-64.sh made the following environmental changes:
-DEBUG_FFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -isystem /Users/yaochung41/anaconda3/envs/scrnaseq/include -march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -Og -g -Wall -Wextra -fcheck=all -fbacktrace -fimplicit-none -fvar-tracking-assignments
-DEBUG_FORTRANFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -isystem /Users/yaochung41/anaconda3/envs/scrnaseq/include -march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -Og -g -Wall -Wextra -fcheck=all -fbacktrace -fimplicit-none -fvar-tracking-assignments
-F77=/Users/yaochung41/anaconda3/envs/scrnaseq/bin/x86_64-apple-darwin13.4.0-gfortran
-F90=/Users/yaochung41/anaconda3/envs/scrnaseq/bin/x86_64-apple-darwin13.4.0-gfortran
-F95=/Users/yaochung41/anaconda3/envs/scrnaseq/bin/x86_64-apple-darwin13.4.0-gfortran
-FC=/Users/yaochung41/anaconda3/envs/scrnaseq/bin/x86_64-apple-darwin13.4.0-gfortran
-FFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -isystem /Users/yaochung41/anaconda3/envs/scrnaseq/include
-FORTRANFLAGS=-march=nocona -mtune=core2 -ftree-vectorize -fPIC -fstack-protector -O2 -pipe -isystem /Users/yaochung41/anaconda3/envs/scrnaseq/include
-GFORTRAN=/Users/yaochung41/anaconda3/envs/scrnaseq/bin/x86_64-apple-darwin13.4.0-gfortran
(scrnaseq) yaochung41@x86_64-apple-darwin13 library % R

#然后我尝试使用library(scran)从R 3.6.3加载包,我也收到错误

Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(scran)
Loading required package: SingleCellExperiment
Loading required package: SummarizedExperiment
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’:

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which, which.max, which.min

Loading required package: S4Vectors

Attaching package: ‘S4Vectors’

The following object is masked from ‘package:base’:

    expand.grid

Loading required package: IRanges
Loading required package: GenomeInfoDb
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: DelayedArray
Loading required package: matrixStats

Attaching package: ‘matrixStats’

The following objects are masked from ‘package:Biobase’:

    anyMissing, rowMedians

Loading required package: BiocParallel

Attaching package: ‘DelayedArray’

The following objects are masked from ‘package:matrixStats’:

    colMaxs, colMins, colRanges, rowMaxs, rowMins, rowRanges

The following objects are masked from ‘package:base’:

    aperm, apply, rowsum

Error: package or namespace load failed for ‘scran’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/yaochung41/anaconda3/envs/scrnaseq/lib/R/library/scran/libs/scran.dylib':
  dlopen(/Users/yaochung41/anaconda3/envs/scrnaseq/lib/R/library/scran/libs/scran.dylib, 6): Library not loaded: @rpath/libopenblasp-r0.3.7.dylib
  Referenced from: /Users/yaochung41/anaconda3/envs/scrnaseq/lib/R/library/scran/libs/scran.dylib
  Reason: image not found```


我遇到了你今天遇到的确切 第二个错误,我想我已经找到了解决办法。

经过一些挖掘,我发现我的问题是 openblas 而不是 SCRAN。 我的修复是:

$ conda install openblas=0.3.7

在你的文件中搜索 "libopenblasp-r0.3.7" 并将其复制到你正在使用的 anaconda3 环境的 lib 文件夹中,即 /Users/yaochung41/anaconda3/envs/scrnaseq/lib/:

$ find /home/username/ -name libopenblasp-r0.3.7
$ mv [PATH to libopenblasp-r0.3.7] /Users/yaochung41/anaconda3/envs/scrnaseq/lib/