【问题标题】:Can't install any R packages on Linux Server无法在 Linux 服务器上安装任何 R 包
【发布时间】:2018-07-28 11:50:10
【问题描述】:

我似乎无法在我的 Amazon linux 服务器上安装任何 R 包,该服务器在 EC2 上运行。这是一个尝试安装“broom”包的简单示例。知道这里发生了什么吗?任何帮助将不胜感激,因为我已经坚持了大约 5 个小时。我在下面粘贴了所有控制台输出。

install.packages("扫帚")

Installing package into ‘/home/rstudio/R/x86_64-redhat-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘mnormt’, ‘psych’

trying URL 'https://cran.rstudio.com/src/contrib/mnormt_1.5-5.tar.gz'
Content type 'application/x-gzip' length 37169 bytes (36 KB)
==================================================
downloaded 36 KB

trying URL 'https://cran.rstudio.com/src/contrib/psych_1.7.8.tar.gz'
Content type 'application/x-gzip' length 3311758 bytes (3.2 MB)
==================================================
downloaded 3.2 MB

trying URL 'https://cran.rstudio.com/src/contrib/broom_0.4.3.tar.gz'
Content type 'application/x-gzip' length 1397648 bytes (1.3 MB)
==================================================
downloaded 1.3 MB

* installing *source* package ‘mnormt’ ...
** package ‘mnormt’ successfully unpacked and MD5 sums checked
** libs
gfortran -m64   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -I/usr/lib64/gfortran/modules  -c biv-nt.f -o biv-nt.o
f951: Warning: Nonexistent include directory ‘/usr/lib64/gfortran/modules’ [-Wmissing-include-dirs]
biv-nt.f:371:11:

       hs = sign( one, dh - r*dk )
           1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
biv-nt.f:372:11:

       ks = sign( one, dk - r*dh )
           1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
gfortran -m64   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -I/usr/lib64/gfortran/modules  -c sadmvnt.f -o sadmvnt.o
f951: Warning: Nonexistent include directory ‘/usr/lib64/gfortran/modules’ [-Wmissing-include-dirs]
sadmvnt.f:976:3:

  10      END DO
   1
Warning: Label 10 at (1) defined but not used
sadmvnt.f:80:15:

       INFORM = MVNNIT( N, CORREL, LOWER, UPPER, INFIN, INFIS, D, E )
               1
Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]
sadmvnt.f:217:38:

         IF ( MINCLS .LT. 0 ) SBRGNS = WORK(LENWRK)
                                      1

[ 删掉大约 20 个与上述内容相似的例子]

Warning: ‘__result_bvn’ may be used uninitialized in this function [-Wmaybe-uninitialized]
sadmvnt.f:762:0:

       DOUBLE PRECISION FUNCTION BVN ( LOWER, UPPER, INFIN, CORREL )

note: ‘__result_bvn’ was declared here
sadmvnt.f:1046:0:

                   IF ( INFI(I) .EQ. 2 ) Y(I) = ( AMIN + BMIN )/2

Warning: ‘bmin’ may be used uninitialized in this function [-Wmaybe-uninitialized]
sadmvnt.f:1046:0: Warning: ‘amin’ may be used uninitialized in this function [-Wmaybe-uninitialized]
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -L/usr/local/lib64 -o mnormt.so biv-nt.o sadmvnt.o -lgfortran -lm -lquadmath -L/usr/lib64/R/lib -lR
/usr/bin/ld: cannot find -lgfortran
/usr/bin/ld: cannot find -lquadmath
collect2: error: ld returned 1 exit status
make: *** [mnormt.so] Error 1
ERROR: compilation failed for package ‘mnormt’
* removing ‘/home/rstudio/R/x86_64-redhat-linux-gnu-library/3.4/mnormt’
Warning in install.packages :
  installation of package ‘mnormt’ had non-zero exit status
ERROR: dependency ‘mnormt’ is not available for package ‘psych’
* removing ‘/home/rstudio/R/x86_64-redhat-linux-gnu-library/3.4/psych’
Warning in install.packages :
  installation of package ‘psych’ had non-zero exit status
ERROR: dependency ‘psych’ is not available for package ‘broom’
* removing ‘/home/rstudio/R/x86_64-redhat-linux-gnu-library/3.4/broom’
Warning in install.packages :
  installation of package ‘broom’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmp23XrRj/downloaded_packages’

这是 R.Version() 的输出

R.Version()

$platform
[1] "x86_64-redhat-linux-gnu"

$arch
[1] "x86_64"

$os
[1] "linux-gnu"

$system
[1] "x86_64, linux-gnu"

$status
[1] ""

$major
[1] "3"

$minor
[1] "4.1"

$year
[1] "2017"

$month
[1] "06"

$day
[1] "30"

$`svn rev`
[1] "72865"

$language
[1] "R"

$version.string
[1] "R version 3.4.1 (2017-06-30)"

$nickname
[1] "Single Candle"

【问题讨论】:

  • 那么cannot find -lgfortran的哪一部分不清楚?
  • 这是一个公平的观点。我仍然不确定该怎么做。它似乎不是一个我可以通过 yum install 来解决问题的软件包,所以我迷路了。
  • 是的,通常是这样。搜索 libgfortran-dev 或类似的东西。
  • 我。读。什么。你。写道。在搜索 yum 和 pip 之后,我似乎找不到任何接近 libgfortran-dev 的东西
  • 我想通了,只是在帖子上发布了答案。感谢您抽出宝贵时间提供帮助。

标签: r linux rstudio-server


【解决方案1】:

感谢以下帖子,我想通了: usr/bin/ld: cannot find -l<nameOfTheLibrary>

我必须运行以下代码来创建包的符号链接

sudo ln -s /usr/lib/gcc/x86_64-amazon-linux/6.4.1/libgfortran.so /usr/lib64/
sudo ln -s /usr/lib/gcc/x86_64-amazon-linux/6.4.1/libquadmath.so /usr/lib64/

【讨论】:

  • 超级约翰-感谢符号链接。我发现在 Amazon Linux 上,必须手动查找 R 包安装程序正在寻找的文件并创建从它们预期位置到实际位置的符号链接实际上很常见。当我能通过谷歌找到链接时,我总是很高兴,就像这次!通过搜索文件夹结构找到它们非常糟糕。
猜你喜欢
  • 2013-12-12
  • 1970-01-01
  • 2018-06-26
  • 1970-01-01
  • 2017-12-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多