下载XML和RCurl R软件包时出现“非零退出状态”错误

时间:2012-12-12 18:34:00

标签: xml r install package rcurl

我遇到了这个问题:

> install.packages("RCurl")
Installing package(s) into ‘/home/username/R/x86_64-redhat-linux-gnu-library/2.13’
(as ‘lib’ is unspecified)
trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/RCurl_1.95-3.tar.gz'
Content type 'application/x-gzip' length 868491 bytes (848 Kb)
opened URL
==================================================
downloaded 848 Kb

* installing *source* package ‘RCurl’ ...
checking for curl-config... no
Cannot find curl-config
ERROR: configuration failed for package ‘RCurl’
* removing ‘/home/username/R/x86_64-redhat-linux-gnu-library/2.13/RCurl’
Warning in install.packages :
  installation of package 'RCurl' had non-zero exit status

The downloaded packages are in
    ‘/tmp/RtmpKyAgF8/downloaded_packages’

> install.packages("XML")
Installing package(s) into ‘/home/username/R/x86_64-redhat-linux-gnu-library/2.13’
(as ‘lib’ is unspecified)
trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/XML_3.95-0.1.tar.gz'
Content type 'application/x-gzip' length 1724282 bytes (1.6 Mb)
opened URL
==================================================
downloaded 1.6 Mb

* installing *source* package ‘XML’ ...
checking for gcc... gcc
checking for C compiler default output file name... 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
No ability to remove finalizers on externalptr objects in this verison of R
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/username/R/x86_64-redhat-linux-gnu-library/2.13/XML’
Warning in install.packages :
  installation of package 'XML' had non-zero exit status

The downloaded packages are in
    ‘/tmp/RtmpKyAgF8/downloaded_packages’

4 个答案:

答案 0 :(得分:2)

您需要将RCurl和XML的版本与您正在使用的R版本相匹配。由于您的R版本是当前版本背后的主要版本,因此没有理由认为当前版本的XML和Rcurl会匹配。您可以尝试从存档版本进行安装。我会从大约一年半前选择一个......或者只是更新你的R装置。

在@TylerRinker的链接中可能存在有用信息的内核,尽管它是错误版本的错误操作系统。如果您修剪网址并改为查看:http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.13/,您将能够确定在redhat上使用哪个版本的源软件包来使用过时的R版本。

答案 1 :(得分:2)

在CentOS 6.4上运行,我刚刚成功地按照以下步骤操作:

  1. 使用Linux命令行安装curl-devel和libxml:
  2. $ sudo yum install curl curl-devel
    $ sudo yum -y install libxml2 libxml2-devel
    
    1. 在R控制台上,重新启动R会话并安装RCurl和XML包:
    2. >> install.packages("RCurl")
      >> install.packages("XML")
      
      1. 加载库:
      2. >> library(RCurl)
        >> library(XML)
        

        希望这能为你节省一天的时间!

答案 2 :(得分:0)

安装RCurl时遇到了类似的问题。我需要的软件包在Amazon Linux上称为libcurl-devel,根据this post that answered my question,也称为CentOS。可以使用命令sudo yum install libcurl-devel进行安装。如果您使用的是基于Debian的发行版,则该软件包可能具有不同的名称,并将使用apt。

进行安装

您的XML库问题可能有类似的解决方案。

答案 3 :(得分:0)

要在Ubuntu上安装curl和xml。运行

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

在R中安装软件包的错误消息表明curlxml库不存在或找不到。