安装带有 lblas 和 lapack 依赖项的 R 包时出现问题

安装带有 lblas 和 lapack 依赖项的 R 包时出现问题

我正在尝试将 HMSC R 包安装到 Linux Ubuntu 18.04.2 LTS 系统上的 RStudio 版本 1.2.1335 和 R 版本 3.6.1 (2019-07-05) -- “脚趾动作”

通过R安装的代​​码如下

library(devtools)
install_url('https://cran.r-project.org/src/contrib/Archive/BayesLogit/BayesLogit_0.6.tar.gz')
install_github("hmsc-r/HMSC", build_opts = c("--no-resave-data", "--no-manual"))

安装 BayesLogit_0.6.tar.gz 时出现以下错误

/home/barefootbushman/miniconda3/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -lblas
/home/barefootbushman/miniconda3/bin/../lib/gcc/x86_64-conda_cos6-linux-gnu/7.3.0/../../../../x86_64-conda_cos6-linux-gnu/bin/ld: cannot find -llapack
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'BayesLogit.so' failed
make: *** [BayesLogit.so] Error 1
ERROR: compilation failed for package ‘BayesLogit’
* removing ‘/home/barefootbushman/R/x86_64-pc-linux-gnu-library/3.6/BayesLogit’
Error in i.p(...) : 
  (converted from warning) installation of package ‘/tmp/RtmpL8qXxH/file18aa17542138/BayesLogit_0.6.tar.gz’ had non-zero exit status

我已经使用以下方法检查了 -lblas 和 -lapack 的安装

sudo apt-get update

Hit:1 http://nz.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://nz.archive.ubuntu.com/ubuntu bionic-updates InRelease                                             
Hit:3 http://nz.archive.ubuntu.com/ubuntu bionic-backports InRelease                                           
Hit:4 https://repo.skype.com/deb stable InRelease                                                              
Hit:5 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease                                    
Get:6 https://desktop-download.mendeley.com/download/apt stable InRelease [2,456 B]                            
Ign:7 http://dl.bintray.com/basespace/BaseMount-DEB saucy InRelease                                            
Ign:8 http://dl.bintray.com/basespace/BaseSpaceFS-DEB saucy InRelease                          
Hit:9 http://security.ubuntu.com/ubuntu bionic-security InRelease                              
Hit:10 http://ppa.launchpad.net/inkscape.dev/stable/ubuntu bionic InRelease
Get:11 http://dl.bintray.com/basespace/BaseMount-DEB saucy Release [1,838 B]                        
Get:12 http://dl.bintray.com/basespace/BaseSpaceFS-DEB saucy Release [1,837 B]                               
Hit:13 http://ppa.launchpad.net/marutter/rrutter/ubuntu bionic InRelease                                     
Fetched 6,131 B in 2s (4,067 B/s)                  
Reading package lists... Done

其次是

sudo apt-get install libblas-dev liblapack-dev

Reading package lists... Done
Building dependency tree       
Reading state information... Done
libblas-dev is already the newest version (3.7.1-4ubuntu1).
liblapack-dev is already the newest version (3.7.1-4ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 28 not upgraded.

但是,当我尝试在 R 中安装 BayesLogit 时仍然收到相同的错误。

任何有关如何克服此错误的帮助都将不胜感激。克里斯

答案1

要在所有当前支持的 Ubuntu 版本中安装 HMISC R 包,请打开终端并输入:

sudo apt install r-cran-hmisc  

r-cran-hmisc 包不依赖于 libblas-dev 或 liblapack-dev,因此在尝试安装 r-cran-hmisc 时不会收到cannot find -lblas或 错误消息。cannot find -llapack

尝试安装 HMISC R 包时收到的错误消息肯定是 Anaconda 的错误,但我不知道罪魁祸首 Anaconda 文件位于系统中的哪个位置。通常,当路径被 Anaconda 破坏时,您可以将其符号链接回相应的 Ubuntu 可执行文件。如果 Anaconda 弄乱了系统中的太多路径,那么摆脱混乱的唯一方法是完全卸载和清除 Anaconda。

相关内容