开发者

Unable to install R package in Ubuntu 11.04 [closed]

开发者 https://www.devze.com 2023-04-12 19:23 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Closed 9 years ago.

  • This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
  • This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question

I'm new to Linux and R.

I installed R 2.12 in Ubuntu 11.04. Today I tried to install a new package, so I ran the following command:

install.packages('XML')

But the installation failed and gave the following information:

* 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/spirit/R/i686-pc-linux-gnu-library/2.12/XML’

The downloaded packages are in
    ‘/tmp/RtmpoZYxnv/downloaded_packages’
Warning message:
In install.packages("XML") :
  installation of package 'XML' had non-zero exit status

I also tried:

sudo install.packages('XML')

But it gives the same error information.

Anyone can give me any advice?


The install.packages method

You need to install the ubuntu package libxml2-dev So in a shell prompt type:

sudo apt-get update
sudo apt-get install libxml2-dev

You will need special sudo powers for this.

Ubuntu package method

As Richie and Dirk mentioned, you can also use:

sudo apt-get install r-cran-xml

If you go down this path, I would recommend that you check out the R ubuntu sources page which will ensure you have a current version of R and the associated R packages. This could be important if you are using the LTS version of ubuntu.


The answer by Colin is correct in a narrow sense, but at the same time wrong as you can just say

 sudo apt-get install r-cran-xml

as XML is one of the CRAN packages available in Ubuntu. Do apt-cache search r-cran-* do see the others.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号