“非零退出状态” R 3.0.1“ XML”和“ RCurl”


69

我在Ubuntu 13.10机器上安装XML和RCurl时遇到了一些麻烦。我今天执行了所有sudo更新和升级。

我正在尝试将拨浪鼓用于R。我无法安装使用拨浪鼓所需的“ XML”。这是相当多的这是问同样的问题在这里仅仅一年后和不同的操作系统。以下是我返回的错误消息:

> install.packages("RCurl")
Installing package into ‘/home/steven/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/RCurl_1.95-4.1.tar.gz'
Content type 'application/x-gzip' length 870915 bytes (850 Kb)
opened URL
==================================================
downloaded 850 Kb

* installing *source* package ‘RCurl’ ...
** package ‘RCurl’ successfully unpacked and MD5 sums checked
checking for curl-config... no
Cannot find curl-config
ERROR: configuration failed for package ‘RCurl’
* removing ‘/home/steven/R/x86_64-pc-linux-gnu-library/3.0/RCurl’
Warning in install.packages :
  installation of package ‘RCurl’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpUwBkbS/downloaded_packages’
> install.packages("XML")
Installing package into ‘/home/steven/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/XML_3.98-1.1.tar.gz'
Content type 'application/x-gzip' length 1582216 bytes (1.5 Mb)
opened URL
==================================================
downloaded 1.5 Mb

* installing *source* package ‘XML’ ...
** package ‘XML’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... 
rm: cannot remove 'a.out.dSYM': Is a directory
a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for sed... /bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking for xml2-config... no
Cannot find xml2-config
ERROR: configuration failed for package ‘XML’
* removing ‘/home/steven/R/x86_64-pc-linux-gnu-library/3.0/XML’
Warning in install.packages :
  installation of package ‘XML’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpUwBkbS/downloaded_packages’

不太确定如何从这里继续。


11
您是否在Linux上安装了curl和xml。运行sudo apt-get install libcurl4-openssl-devsudo apt-get install libxml2-dev
jdharrison

为R安装开发库很重要。您可能没有选择该选项(并且您选择安装过时的版本进行引导。)
IRTFM 2013年

@jdharrison我没有尝试过这些命令,今晚回家时我会给他们一个尝试。
MCP_infiltrator 2013年

@IShouldBuyABoat我不知道我需要安装R的开发库。将Ubuntu从13.04升级到13.01时,我安装了3.0.1,我只是从软件中心安装。
MCP_infiltrator 2013年

@jdharrison解决了问题,因此您可以将其列出为答案,我会接受的,谢谢。
MCP_infiltrator

Answers:


121

在Ubuntu上安装curl和xml。跑

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

R中安装的软件包上的错误消息表示curl和xml库不存在或找不到。


libcurl4-gnutls-dev将替代libcurl4-openssl-dev。另请参见askubuntu.com/a/428379/17060
迈克尔·迈克尔

我正在在Ubuntu 16.04上运行R的WSL中​​工作;这个命令在bash提示符下已经解决了我的问题apt-get install libssl-dev
Bhail

27

在CentOS 6+中,您可以使用

sudo yum -y install curl
sudo yum -y install libcurl libcurl-devel
sudo yum -y install libxml2 libxml2-devel

8
您还需要sudo yum -y install libxml2 libxml2-devel
xbsd 2014年

当我安装“ h2o”时,前两个命令对我已经足够了
Bas 2015年

2

对于无法使用yum或安装的用户apt-get,我分享我的经验:

libcurl-openssl-dev通过下载源代码并进行编译来安装自己。不过,我仍然遇到Cannot find curl-config问题...在查看RCurl源代码并看到CURL_CONFIG引用了环境变量之前,我不知道该怎么做。我尝试将.bashrc它设置为自己的方法,但似乎可行:

export CURL_CONFIG=~/my/libcurl/curl-config


0

对于ubuntu 18.05有时存储库存在如下问题

在sudoedited行中添加以下存储库

deb http://security.ubuntu.com/ubuntu仿生安全性主要

sudoedit /etc/apt/sources.list 
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev --fix-broken
sudo apt-get install libcurl4-openssl-dev libxml2-deve
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.