saltmangotree saltmangotree - 4 months ago 12
R Question

unable to install 'XML' package dependency for 'pmml' on Ubuntu

I was trying to install the 'pmml' package in R using the install.packages('') option as well as from source. But keep getting errors both ways.

Trying from R

install.packages('pmml',dependencies=T)
Cannot find xml2-config
ERROR: configuration failed for package ‘XML’
* removing ‘/home/PepperBoy/R/x86_64-pc-linux-gnu-library/3.2/XML’
ERROR: dependency ‘XML’ is not available for package ‘pmml’
* removing ‘/home/PepperBoy/R/x86_64-pc-linux-gnu-library/3.2/pmml’


Trying from source

> install.packages('pmml_1.4.2.tar.gz', repos = NULL, type="source")
Installing package into ‘/home/PepperBoy/R/x86_64-pc-linux-gnu-library/3.2’
(as ‘lib’ is unspecified)
ERROR: dependency ‘XML’ is not available for package ‘pmml’
* removing ‘/home/PepperBoy/R/x86_64-pc-linux-gnu-library/3.2/pmml’
Warning message:
In install.packages("pmml_1.4.2.tar.gz", repos = NULL, type = "source") :
installation of package ‘pmml_1.4.2.tar.gz’ had non-zero exit status


Trying using R CMD INSTALL

% R CMD INSTALL pmml_1.4.2.tar.gz
* installing to library ‘/home/PepperBoy/R/x86_64-pc-linux-gnu-library/3.2’
ERROR: dependency ‘XML’ is not available for package ‘pmml’
* removing ‘/home/PepperBoy/R/x86_64-pc-linux-gnu-library/3.2/pmml’


I have also tried install the xml library for R using these same methods, but keep getting similar errors like

ERROR: configuration failed for package ‘XML’
* removing ‘/home/PepperBoy/R/x86_64-pc-linux-gnu-library/3.2/XML’

Answer

You need to install the system library libxm2-dev to install the XML package (on which pmml depends). So, if you are on Debian or Ubuntu, just install it through:

sudo apt-get install libxml2-dev

and then proceed with the R packages installation. Be careful to check the SystemRequirements section in the home page of any R package you want to install (for XML, see here).