天天看點

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()
           

繼續閱讀