简体   繁体   English

无法在 R 上安装软件包

[英]Unable to install a package on R

I'm getting an issue when I try to install Bioconductor for R. I've searched everywhere for solutions however nothing is really working for me.当我尝试为 R 安装 Bioconductor 时遇到了一个问题。我到处寻找解决方案,但是没有任何东西对我有用。 Please, any advice?请问,有什么建议吗?

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

I've tried to reinstall R and it didn't work.我试过重新安装R,但没有用。

The code I am using to install bioconductor is:我用来安装 bioconductor 的代码是:

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

I had the same problem.我有同样的问题。 This happens since I updated to R4.0.这是因为我更新到 R4.0。 I've seen that in Mac (and maybe Windows) can be related to missing Rtools .我已经看到在 Mac(也许是 Windows)中可能与缺少 Rtools相关。 In Linux, I tried to install the package from other mirrors (this solved my problem in the past), but no success.在Linux中,我尝试从其他镜像安装包(这解决了我过去的问题),但没有成功。 Finally, I realized that the initial error is "make: gfortran: No such file or directory"最后,我意识到最初的错误是“make: gfortran: No such file or directory”

Therefore, I installed gcc & gcc-fortran and that solved it!因此,我安装了 gcc & gcc-fortran 并解决了它!

In Manjaro, Arch linux:在 Manjaro 中,Arch linux:

pacman -S gcc
pacman -S gcc-fortran

In Debian or Ubuntu should be:在 Debian 或 Ubuntu 中应该是:

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

Check here for more information:在这里查看更多信息:

因为现在新版本的Bioconductor是BiocManager,尝试使用这个: install.packages("BiocManager")

Apparently, it is trying to install package nlme as a dependency and fails doing that.显然,它试图将包nlme作为依赖项安装,但失败了。 Did you try installing that one manually before installing Bioconductor ?在安装 Bioconductor 之前,您是否尝试过手动安装那个? That could give us more info on the issue.这可以为我们提供有关该问题的更多信息。

Just as a heads up for someone who encounters similar issue.就像提醒遇到类似问题的人一样。 I was presented with a choice of installing a binary or compiling from scratch.我可以选择安装二进制文件或从头开始编译。 As I chose compilation option, it was failing to install nlme .当我选择编译选项时,它无法安装nlme However, installation of binary was successful and there was a minor version difference between the source and the binary.但是,二进制文件安装成功,源代码和二进制文件之间存在细微的版本差异。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM