I am using a ubuntu AMI in my AWS and have launched a R studio server.
I am finding trouble in installing the R packages.
Whenever I try to install the packages I get an error
> Installing package into
> ‘/home/rstudio2/R/x86_64-pc-linux-gnu-library/3.0’ (as ‘lib’ is
> unspecified) Warning in install.packages : dependency ‘xml2’ is not
> available also installing the dependencies ‘jsonlite’, ‘mime’, ‘curl’,
> ‘openssl’, ‘R6’, ‘httr’, ‘base64enc’, ‘digest’, ‘aws.signature’
>
>
> The downloaded source packages are in
> ‘/tmp/Rtmp1BrKS6/downloaded_packages’
Could anyone help me to backtrace the reason for error. Would be thankful, I have spent almost a day . could not figure out
dependency ‘xml2’ is not available
From this error, we can understand that package XML2 is missing. You need to install the system library libxml2-dev to install the XML2 package. So use the following command to install the package:
sudo apt install libxml2-dev
After this proceed with R package installation.
Related
system: ubuntu 18.04
Rstudio version 3.4.4
Whenever i try to install tidyverse this error comes up, how do i add the directory containing the lib-curl to the package configuration search path?
installing source package ‘curl’ ...
package ‘curl’ successfully unpacked and MD5 sums checked
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
.
.
.
.
ERROR: configuration failed for package ‘xml2’
removing ‘/home/javed/R/x86_64-pc-linux-gnu-library/3.4/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
ERROR: dependencies ‘curl’, ‘openssl’ are not available for package ‘httr’
* removing ‘/home/javed/R/x86_64-pc-linux-gnu-library/3.4/httr’
Warning in install.packages :
installation of package ‘httr’ had non-zero exit status
ERROR: dependencies ‘xml2’, ‘httr’ are not available for package ‘rvest’
* removing ‘/home/javed/R/x86_64-pc-linux-gnu-library/3.4/rvest’
Warning in install.packages :
installation of package ‘rvest’ had non-zero exit status
ERROR: dependencies ‘httr’, ‘rvest’, ‘xml2’ are not available for package ‘tidyverse’
* removing ‘/home/javed/R/x86_64-pc-linux-gnu-library/3.4/tidyverse’
Warning in install.packages :
installation of package ‘tidyverse’ had non-zero exit status
Install these missing dependencies before installing R packages:
sudo apt install libcurl4-openssl-dev libssl-dev libxml2-dev
Source: https://blog.zenggyu.com/en/post/2018-01-29/installing-r-r-packages-e-g-tidyverse-and-rstudio-on-ubuntu-linux/
Quit R and open up a command window and confirm that libcurl is indeed not installed on Ubuntu
apt list --installed | grep libcurl
You should see no results.
Install the package
sudo apt update
sudo apt install libcurl4-openssl-dev
Open up R and reinstall tidyverse.
If you still get error messages in R, you might have to install additional missing Linux packages by repeating similar steps.
I could install some packages early ,but recently I can't install any packages nor can I update my packages.
For example,every time I try to install the "forecast" package with
install.packages("forecast")
,I get the following message:
Installing package into ‘C:/Users/Ge/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
also installing the dependencies ‘quadprog’, ‘tseries’, ‘fracdiff’,‘RcppArmadillo’
Packages which are only available in source form, and may need
compilation of C/C++/Fortran: ‘quadprog’ ‘tseries’ ‘fracdiff’
‘RcppArmadillo’ ‘forecast’
These will not be installed
And I have tried to change a mirror using
chooseCRANmirror()
It just can't work.
Please someone help me
I am using R 3.2.2 on a UNIX server (this is installed to my HOME).
Any package that I try to install returns an error message like this:
install.packages('knitr')
Warning: unable to access index for repository
https://cran.rstudio.com/src/contrib
Warning message:
package ‘knitr’ is not available (for R version 3.2.2)
I've also tried downloading the package source and installing manually, but that doesn't work:
install.packages('/home/baker/knitr_1.11.tar.gz',repos= NULL,type='source')
ERROR: dependencies ‘evaluate’, ‘digest’, ‘formatR’, ‘highr’, ‘markdown’, ‘stringr’, ‘yaml’ are not available for package ‘knitr’
* removing ‘/home/baker/R/lib64/R/library/knitr’
Warning message:
In install.packages("/home/baker/knitr_1.11.tar.gz", repos = NULL, :
installation of package ‘/home/baker/knitr_1.11.tar.gz’ had non-zero exit status
This is obviously a super frustrating problem...any ideas? I'm at a total loss.
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’
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).
I was trying to install the devtools package in Rstudio by install.packages("devtools") but failed. The error messages are:
* installing *source* package ‘xml2’ ...
** package ‘xml2’ successfully unpacked and MD5 sums checked
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found
Could not find libxml2. Please install libxml2-devel (rpm) or libxml2-dev (deb).
ERROR: configuration failed for package ‘xml2’
* removing ‘/home/xwang/R/x86_64-pc-linux-gnu-library/3.1/xml2’
Warning in install.packages :
installation of package ‘xml2’ had non-zero exit status
ERROR: dependency ‘xml2’ is not available for package ‘rversions’
* removing ‘/home/xwang/R/x86_64-pc-linux-gnu-library/3.1/rversions’
Warning in install.packages :
installation of package ‘rversions’ had non-zero exit status
ERROR: dependency ‘rversions’ is not available for package ‘devtools’
* removing ‘/home/xwang/R/x86_64-pc-linux-gnu-library/3.1/devtools’
Warning in install.packages :
installation of package ‘devtools’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpYccDpT/downloaded_packages’
Looks like it has trouble finding libxml-2.0. Does anyone know an easy fix to this? I'm using R version 3.1.2.
Eventually I fixed the problem by:
sudo apt-get install libxml2-dev
Then another problems popped up:
Error : object ‘curl_fetch_memory’ is not exported by 'namespace:curl'
which can be solved by installing the curl package:
install.packages("curl")
You just need to update to the newest version of R (R version 3.2.1)
It require some developer libraries (sources): curl developer, xml2 developer as dependecy.
so install it with the package repository (yum, dnf, apt-get) and retry to install the devtools package in R.