安装 tidyverse 时出现问题:install.packages 中出现警告:软件包“tidyverse”的安装退出状态为非零

安装 tidyverse 时出现问题:install.packages 中出现警告:软件包“tidyverse”的安装退出状态为非零
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:10: recipe for target 'Matrix.so' failed
make: *** [Matrix.so] Error 1
ERROR: compilation failed for package ‘Matrix’
* removing ‘/home/ephrem/R/i686-pc-linux-gnu-library/4.1/Matrix’
Warning in install.packages :
  installation of package ‘Matrix’ had non-zero exit status
ERROR: dependency ‘Matrix’ is not available for package ‘mgcv’
* removing ‘/home/ephrem/R/i686-pc-linux-gnu-library/4.1/mgcv’
Warning in install.packages :
  installation of package ‘mgcv’ had non-zero exit status
ERROR: dependency ‘mgcv’ is not available for package ‘ggplot2’
* removing ‘/home/ephrem/R/i686-pc-linux-gnu-library/4.1/ggplot2’
Warning in install.packages :
  installation of package ‘ggplot2’ had non-zero exit status
ERROR: dependency ‘ggplot2’ is not available for package ‘tidyverse’
* removing ‘/home/ephrem/R/i686-pc-linux-gnu-library/4.1/tidyverse’
Warning in install.packages :
  installation of package ‘tidyverse’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmp85JnYq/downloaded_packages’
Warning in install.packages :
  converting NULL pointer to R NULL

我正在使用 Ubuntu 18(如果有帮助的话)架构:i686 CPU 操作模式:32 位,64 位字节顺序:小端

> sessionInfo() 
R version 4.1.1 (2021-08-10) 
Platform: i686-pc-linux-gnu (32-bit) 
Running under: Ubuntu 18.04.6 LTS 
Matrix products: default 
BLAS: /usr/lib/i386-linux-gnu/atlas/libblas.so.3.10.3 
LAPACK: /usr/lib/i386-linux-gnu/atlas/liblapack.so.3.10.3

输出apt-cache policy r-base-dev

r-base-dev:
  Installed: (none)
  Candidate: 4.1.1-1.2004.0
  Version table:
     4.1.1-1.2004.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages
     4.1.1-1.1804.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.1.0-1.2004.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages
     4.1.0-1.1804.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.5-1.2004.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages
     4.0.5-1.1804.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.4-1.2004.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages
     4.0.4-1.1804.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.3-1.2004.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages
     4.0.3-1.1804.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.2-1.2004.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages
     4.0.2-1.1804.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.1-1.2004.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages
     4.0.1-1.1804.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     4.0.0-1.2004.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/ Packages
     4.0.0-1.1804.0 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages
     3.6.3-1bionic 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
     3.6.2-1bionic 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
     3.6.1-3bionic 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
     3.6.1-1bionic 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
     3.6.0-2bionic 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
     3.6.0-1bionic 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
     3.5.3-1bionic 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
     3.5.2-1bionic 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
     3.5.1-2bionic 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
     3.5.1-1bionic 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
     3.5.0-1bionic 500
        500 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Packages
     3.4.4-1ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/universe i386 Packages
     3.0.2-1ubuntu1.1~esm2 -32768
       -32768 https://esm.ubuntu.com/ubuntu trusty-infra-security/main i386 Packages

答案1

通常 R 包的安装需要编译,因此r-base-dev需要特殊的专用包,使用以下命令安装:

sudo apt-get update
sudo apt-get install r-base-dev

您还可以看到错误是不言自明的,相关的开发库布拉斯拉帕克遗漏了。要安装它们和其他所需的软件包,请使用以下命令:

sudo apt-get install liblapack-dev libblas-dev libssl-dev libcurl4-openssl-dev libxml2-dev

然后通过运行重试

R -e install.packages('tidyverse')

相关内容