天天看点

centos7 中安装tidyverse报错 缺少依赖

centos7 中安装tidyverse报错 缺少依赖

需要在服务器中安装ggplot2,于是干脆安装tidyverse一步到位。在Centos7中安装tidyverse包时出现错误,提示缺少系统依赖,在R中没有对应安装包。报错如下

* DONE (testthat)
Making 'packages.html' ... done
ERROR: dependencies ‘curl’, ‘gargle’, ‘googledrive’, ‘httr’ are not available for package ‘googlesheets4’
* removing ‘/usr/lib64/R/library/googlesheets4’
ERROR: dependencies ‘googledrive’, ‘googlesheets4’, ‘httr’, ‘rvest’, ‘xml2’ are not available for package ‘tidyverse’
* removing ‘/usr/lib64/R/library/tidyverse’

The downloaded source packages are in
        ‘/tmp/RtmpoqxQNC/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning messages:
1: In install.packages("tidyverse", dependencies = TRUE) :
  installation of package ‘curl’ had non-zero exit status
2: In install.packages("tidyverse", dependencies = TRUE) :
  installation of package ‘xml2’ had non-zero exit status
3: In install.packages("tidyverse", dependencies = TRUE) :
  installation of package ‘httr’ had non-zero exit status
4: In install.packages("tidyverse", dependencies = TRUE) :
  installation of package ‘gargle’ had non-zero exit status
5: In install.packages("tidyverse", dependencies = TRUE) :
  installation of package ‘rvest’ had non-zero exit status
6: In install.packages("tidyverse", dependencies = TRUE) :
  installation of package ‘covr’ had non-zero exit status
7: In install.packages("tidyverse", dependencies = TRUE) :
  installation of package ‘googledrive’ had non-zero exit status
8: In install.packages("tidyverse", dependencies = TRUE) :
  installation of package ‘googlesheets4’ had non-zero exit status
9: In install.packages("tidyverse", dependencies = TRUE) :
  installation of package ‘tidyverse’ had non-zero exit status
> library(tidyverse)
           

通过报错发现有两个系统依赖没有安装,那个没有就安装那个,在centos中输入以下命令

yum install libxml2-devel
yum install libcurl-devel
           

安装好后回到R中继续安装tidyverse,dependence设置为TRUE。

安装成功

* DONE (tidyverse)
Making 'packages.html' ... done

The downloaded source packages are in
        ‘/tmp/RtmpHnDXTv/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
           

在R中测试

> library(tidyverse)
── Attaching packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.3.1 ──✔ ggplot2 3.3.5     ✔ purrr   0.3.4
✔ tibble  3.1.2     ✔ dplyr   1.0.7
✔ tidyr   1.1.3     ✔ stringr 1.4.0
✔ readr   1.4.0     ✔ forcats 0.5.1
── Conflicts ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
           

继续阅读