无法安装rvest包

时间:2015-06-23 16:54:13

标签: r rvest

我需要为R版本3.1.2(2014-10-31)安装rvest包

我收到这些错误:

    checking whether the C++ compiler supports the long long type... no
*** stringi cannot be built. Upgrade your C++ compiler's settings
ERROR: configuration failed for package ‘stringi’
* removing ‘/usr/local/lib64/R/library/stringi’
ERROR: dependency ‘stringi’ is not available for package ‘stringr’
* removing ‘/usr/local/lib64/R/library/stringr’
ERROR: dependency ‘stringr’ is not available for package ‘httr’
* removing ‘/usr/local/lib64/R/library/httr’
ERROR: dependency ‘stringr’ is not available for package ‘selectr’
* removing ‘/usr/local/lib64/R/library/selectr’
ERROR: dependencies ‘httr’, ‘selectr’ are not available for package ‘rvest’
* removing ‘/usr/local/lib64/R/library/rvest’

关于如何安装R包rvest的任何想法?

4 个答案:

答案 0 :(得分:23)

我的系统是Ubuntu 14.04,R:3.2.3,我遇到了同样的问题。

然后我检查了err meg并尝试安装libcurl4-openssl-dev和libxml2-dev的库:

sudo apt-get install libcurl4-openssl-dev

sudo apt-get install libxml2-dev

安装完成后,install.packages("rvest")成功。

答案 1 :(得分:3)

当我尝试在全新安装的Ubuntu 18.04 上的 Rstudio版本1.1.456中安装Rcurl, XML, rvest, xml2时,我需要诸如tidyverse, DESeq2, RUVSeq之类的依赖项。无论如何,还是有很多缺少的依赖项。这个答案可能适合Ubuntu 18.04的注释,但是我没有那么多声誉。只需在此处尝试总结适用于Ubuntu 18.04的解决方案即可。
在终端中,运行:

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

然后在Rstudio中

install.packages("xml2")
install.packages("rvest")
install.packages("tidyverse")  # might need other dependencies installed in Rstudio

tidyverse得到!
在终端中:

sudo apt-get install libmysqlclient-dev  ## for RMySQL

然后在Rstudio中

source("https://bioconductor.org/biocLite.R")
biocLite("DESeq2")
biocLite('RUVSeq')             ## might have messages as following

installation path not writeable, unable to update packages: cluster, foreign, MASS, Matrix, mgcv, nlme, survival

在终端机中:

sudo R                      ## give R the root permission
## in the R session within the terminal
pks <- c('cluster', 'foreign', 'MASS', 'Matrix', 'mgcv', 'nlme', 'survival')
install.packages(pks)
q()

这是我的经验。希望这个人具有良好的通用性

答案 2 :(得分:2)

我能够构建stringi包:

install.packages('stringi', configure.args='--disable-cxx11')

答案 3 :(得分:0)

我对这个问题的回答肯定是迟了。然而,有人可能会发现它很有用。

我遇到了同样的问题所以我在shell上运行这个命令:

sudo apt-get upgrade pkg-config

它对我有用。