Explore Courses Blog Tutorials Interview Questions
0 votes
in R Programming by (5.3k points)

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:


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


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? Thanks in advance.

1 Answer

0 votes

To install the required package by install.packages method, you need to install the ubuntu package libxml2-dev. In a shell prompt type:

sudo apt-get update 

sudo apt-get install libxml2-dev

You require sudo powers to run these commands.

You can also use the ubuntu package method to install the required package as follows:

sudo apt-get install r-cran-xml

To update to the current version of R and R packages, you can check out this link.

Browse Categories