R: 无法在 Ubuntu 14.04 上安装 'rasclass' 软件包

R: cannot install 'rasclass' package on Ubuntu 14.04

我正在尝试在 R(版本 3.2.3)上安装 'rasclass' 包,但安装总是失败。输出太大,无法粘贴在这里,但我发现了一些对 this question 感兴趣的东西,这可能是解决这个问题的关键。

很快:从终端我可以看到我有 gcc-4.8 和 4.9、g++-4.8 和 4.9,以及 gfortran-4.8。我记得更改 gcc 和 g++ 之间的符号链接以使用“4.9”版本。没有 gfortran-4.9 会不会有问题?如果是这样,下载后如何更改此版本的符号链接?

最后,我只是粘贴了(失败的)包安装的最后一部分。

/usr/bin/ld: impossibile trovare -lgfortran
collect2: error: ld returned 1 exit status
make: *** [RcppEigen.so] Errore 1
ERROR: compilation failed for package ‘RcppEigen’
* removing ‘/home/umberto/R/x86_64-pc-linux-gnu-library/3.2/RcppEigen’
* installing *source* package ‘MatrixModels’ ...
** package ‘MatrixModels’ successfully unpacked and MD5 sums checked
** R
** preparing package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  namespace ‘Matrix’ 1.1-4 is being loaded, but >= 1.1.5 is required
ERROR: lazy loading failed for package ‘MatrixModels’
* removing ‘/home/umberto/R/x86_64-pc-linux-gnu-library/3.2/MatrixModels’
ERROR: dependencies ‘minqa’, ‘RcppEigen’ are not available for package ‘lme4’
* removing ‘/home/umberto/R/x86_64-pc-linux-gnu-library/3.2/lme4’
ERROR: dependencies ‘SparseM’, ‘MatrixModels’ are not available for package ‘quantreg’
* removing ‘/home/umberto/R/x86_64-pc-linux-gnu-library/3.2/quantreg’
ERROR: dependency ‘lme4’ is not available for package ‘pbkrtest’
* removing ‘/home/umberto/R/x86_64-pc-linux-gnu-library/3.2/pbkrtest’
ERROR: dependencies ‘pbkrtest’, ‘quantreg’ are not available for package ‘car’
* removing ‘/home/umberto/R/x86_64-pc-linux-gnu-library/3.2/car’
ERROR: dependencies ‘car’, ‘randomForest’ are not available for package ‘rasclass’
* removing ‘/home/umberto/R/x86_64-pc-linux-gnu-library/3.2/rasclass’

The downloaded source packages are in
    ‘/tmp/RtmphSiL6j/downloaded_packages’
There were 11 warnings (use warnings() to see them)

我尝试安装这个包,最后,我在第二次尝试安装 rasclass 库时成功地安装了库 carpbkrtest

我的配置:Ubuntu 14.04 LTS - R 3.2.1 RC - gcc 4.8.4

确实是gfortran的问题。

我通过 sudo apt-get install gfortran-4.9 安装了 4.9 版,尝试重新安装 rasclass 包及其所有依赖项,现在它可以工作了。正如 this question 的评论中所述,我确实弄乱了 g++gcc 的符号链接,以使用 4.9 版本,但我没有相同版本的 gfortran。这似乎是解决问题的关键。

最后,为了选择 gcc 一个 g++ 版本,我遵循了 this answer。希望这可以帮助任何人。