无法在R上安装软件包

时间:2020-02-07 15:23:42

标签: r bioconductor

当我尝试安装Bioconductor for R时遇到问题。我到处都在寻找解决方案,但实际上没有任何工作对我有用。拜托,有什么建议吗?

The downloaded binary packages are in
    /var/folders/74/y92tqhzj0l98l6syjjl7vtcr0000gn/T//RtmpNYOkbZ/downloaded_packages
Old packages: 'nlme'
Update all/some/none? [a/s/n]: 
a
Warning: unable to access index for repository https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6:
  cannot open URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/PACKAGES'
Package which is only available in source form, and may need compilation of
  C/C++/Fortran: ‘nlme’
Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
installing the source package ‘nlme’

trying URL 'https://cran.rstudio.com/src/contrib/nlme_3.1-144.tar.gz'
Content type 'application/x-gzip' length 778660 bytes (760 KB)
==================================================
downloaded 760 KB

* installing *source* package ‘nlme’ ...
** package ‘nlme’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran  -fPIC  -Wall -g -O2  -c chol.f -o chol.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c corStruct.c -o corStruct.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c gnls.c -o gnls.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c init.c -o init.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c matrix.c -o matrix.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c nlOptimizer.c -o nlOptimizer.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c nlme.c -o nlme.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c nlmefit.c -o nlmefit.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c pdMat.c -o pdMat.o
clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  -fPIC  -Wall -g -O2  -c pythag.c -o pythag.o
gfortran  -fPIC  -Wall -g -O2  -c rs.f -o rs.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o nlme.so chol.o corStruct.o gnls.o init.o matrix.o nlOptimizer.o nlme.o nlmefit.o pdMat.o pythag.o rs.o -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [nlme.so] Error 1
ERROR: compilation failed for package ‘nlme’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/nlme’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/nlme’

The downloaded source packages are in
    ‘/private/var/folders/74/y92tqhzj0l98l6syjjl7vtcr0000gn/T/RtmpNYOkbZ/downloaded_packages’
Warning message:
In install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  installation of package ‘nlme’ had non-zero exit status

我尝试重新安装R,但没有用。

我用来安装生物导体的代码是:

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install(version = "3.10")

4 个答案:

答案 0 :(得分:1)

我有同样的问题。自从我更新到R4.0后,就会发生这种情况。我已经看到,在Mac(也许还有Windows)中,它们可能与missing Rtools有关。在Linux中,我尝试从其他镜像安装软件包(这过去解决了我的问题),但没有成功。最后,我意识到最初的错误是“ make:gfortran:没有这样的文件或目录”

因此,我安装了gcc和gcc-fortran,就解决了!

在Manjaro中,Arch linux:

pacman -S gcc
pacman -S gcc-fortran

在Debian或Ubuntu中应该是:

sudo apt update
sudo apt install build-essential
sudo apt-get install manpages-dev
gcc --version

在此处查看更多信息:

答案 1 :(得分:0)

由于Bioconductor的新版本是BiocManager,请尝试使用此版本:install.packages("BiocManager")

答案 2 :(得分:0)

显然,它正在尝试将软件包nlme安装为依赖项,但这样做失败。在安装Bioconductor之前,您是否尝试过手动安装那个?这样可以为我们提供有关此问题的更多信息。

答案 3 :(得分:0)

就像提醒遇到类似问题的人一样。我可以选择安装二进制文件或从头开始编译。当我选择编译选项时,它无法安装 M。但是,二进制安装成功,源代码和二进制文件之间存在细微的版本差异。