unable to install rvest package - r

I need to install rvest package for R version 3.1.2 (2014-10-31)
I get these errors:
checking whether the C++ compiler supports the long long type... no
*** stringi cannot be built. Upgrade your C++ compiler's settings
ERROR: configuration failed for package ‘stringi’
* removing ‘/usr/local/lib64/R/library/stringi’
ERROR: dependency ‘stringi’ is not available for package ‘stringr’
* removing ‘/usr/local/lib64/R/library/stringr’
ERROR: dependency ‘stringr’ is not available for package ‘httr’
* removing ‘/usr/local/lib64/R/library/httr’
ERROR: dependency ‘stringr’ is not available for package ‘selectr’
* removing ‘/usr/local/lib64/R/library/selectr’
ERROR: dependencies ‘httr’, ‘selectr’ are not available for package ‘rvest’
* removing ‘/usr/local/lib64/R/library/rvest’
Any ideas on how I could install R package rvest?

My system is Ubuntu 14.04 with R:3.2.3, and I had the same problem.
Then I checked err meg and tried to install library of libcurl4-openssl-dev and libxml2-dev:
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libxml2-dev
After installed, install.packages("rvest") was successful.

I needed dependencies such as Rcurl, XML, rvest, xml2, when I was trying to install tidyverse, DESeq2, RUVSeq in Rstudio Version 1.1.456 on a fresh installed Ubuntu 18.04. Anyway, there were a bunch of missing dependencies. This answer might fit better as a comment for Ubuntu 18.04, but I don't have that many reputation. So just trying to make a summary of solutions works for Ubuntu 18.04 here.
In the terminal, run:
sudo apt-get install libcurl4-openssl-dev libssl-dev
sudo apt-get install libxml2-dev
Then within Rstudio,
install.packages("xml2")
install.packages("rvest")
install.packages("tidyverse") # might need other dependencies installed in Rstudio
Got tidyverse!
In the terminal:
sudo apt-get install libmysqlclient-dev ## for RMySQL
Then within the Rstudio
source("https://bioconductor.org/biocLite.R")
biocLite("DESeq2")
biocLite('RUVSeq') ## might have messages as following
installation path not writeable, unable to update packages: cluster, foreign, MASS, Matrix, mgcv, nlme, survival
In the terminal:
sudo R ## give R the root permission
## in the R session within the terminal
pks <- c('cluster', 'foreign', 'MASS', 'Matrix', 'mgcv', 'nlme', 'survival')
install.packages(pks)
q()
That's my own experience. Hope this one has a good Generalizability.

I was able to build the stringi package as this:
install.packages('stringi', configure.args='--disable-cxx11')

My answer is definitely late to this question. Nevertheless, somebody may find it useful.
I run into the same problem so I run this command on the shell:
sudo apt-get upgrade pkg-config
It worked for me.

Related

Error installing rgdal: API to be used not found

I have Fedora Workstation 34.
I have installed gdal-devel rpm on my system:
sudo dnf install gdal-devel
Now I am trying to install the R rgdal package.
But the installation fails with the following error message:
configure: API to be used as yet undetermined, searching ...
configure: error: API to be used not found
ERROR: configuration failed for package ‘rgdal’
* removing ‘/home/raffaele/R/x86_64-redhat-linux-gnu-library/4.0/rgdal’
The downloaded source packages are in
‘/tmp/RtmpZRbq1a/downloaded_packages’
✔ Package 'rgdal' successfully installed.
Warning message:
In utils::install.packages("rgdal", repos = "https://cran.rstudio.com/") :
installation of package ‘rgdal’ had non-zero exit status
Please note that in the above the
Package 'rgdal' successfully installed.
is wrong.
In particular it looks like it can't find an API.
How can I fix this problem and install the rgdal R package?
The above instructions are for Debian/Ubuntu or similar. Dependencies in Linux need to be installed separately as indicated in the CRAN for rgdal. On Fedora use
sudo dnf install gdal-devel proj-devel
Not that proj-devel is necessary to prevent the error "configure: error: API to be used not found". After which in R you can use install.packages("rgdal"). Using the package manager is also a good solution.
Based on the instructions by dncgst, I would suggest first installing the packages libgdal-dev and libproj-dev:
sudo apt-get install gdal-bin proj-bin libgdal-dev libproj-dev
I discovered you can install the binaries directly from the package manager
sudo dnf install R-rgdal

R ERROR: dependencies ‘xml2’, ‘httr’ are not available for package (Linux Mint 20.1)

I did not quite know where this belongs exactly, so I decided to post this here on stack overflow.
I recently had package issues with R and R-Studio on Linux Mint 20.1, where I always recieved dependency errors when installing packages like plotly and tidyverse. Therefore, in order to test if my system was responsible I live booted a fresh Linux Mint USB and installed R and R-Studio the following way:
sudo apt update
sudo apt dist-upgrade
sudo apt install r-base
Then download R-Studio from here and installed it like:
sudo apt-get install gdebi-core
# Install R-Studio with gdebi
sudo gdebi rstudio-1.2.5042-amd64.deb
Then, I opened RStudio by typing rstudio in the terminal. Inside RStudio I tried to install the package tidyverse by install.packages("tidyverse") which resulted in some dependency errors like:
ERROR: dependencies ‘xml2’, ‘httr’ are not available for package ‘rvest’
* removing ‘/home/mint/R/x86_64-pc-linux-gnu-library/3.6/rvest’
* installing *source* package ‘tibble’ ...
The solution was to use the command, suggested in the r-lib issue by #fredaas:
sudo apt install build-essential libcurl4-gnutls-dev libxml2-dev libssl-dev
By using this command I was able to resolve the issue and install every package I required flawlessly.
I am sorry if this does not belong here but I hope I can help someone saving hours of troubleshooting. This issues is maybe caused by Linux Mint or the most recent R Version 4.0.3 so I was not sure where to share my results.

installation of package ‘devtools’ had non-zero exit status - R packge or R studio

R version 3.4.4. Ubuntu 18.04.5 LTS.
install.packages('devtools')
The output shows missing "gert", "usethis".
Then I tried to install the failed packages "gert".
install.packages('gert', repos='https://cran.rstudio.com/')
Output is an error of missing "libgit2-dev".
Next, I went to install "libgit2-dev", and failed all the time.
The reason of failure of installing "libgit2" is, one shall install the "git2r" instead. (Reference: https://github.com/libgit2/libgit2 and https://github.com/ropensci/git2r)
** Solve the "gert" below:**
install.packages('git2r') # https://github.com/ropensci/git2r\
install.packages('gert')\
below refers to: https://github.com/r-lib/gert the installation hints.
On Linux you need to install libgit2:
Debian: libgit2-dev
Fedora / CentOS: libgit2-devel
For Ubuntu Trusty and Xenial, you can use libgit2 backports from
this ppa:
sudo add-apt-repository ppa:cran/libgit2
sudo apt-get update
sudo apt-get install libgit2-dev
DONE!
After that, the package "usethis" can be installed normally.
install.packages('usethis')
DONE!
In the end, the "devtools" can also be installed normally.
install.packages('devtools')\
The error of "non-zero status" does not show up.
library(devtools)
Loading required package: usethis
Extend story:
the package tidyverse can be intalled successfully after the devtools problem got solved.
Happy end.

Installing rgl and rgdal packages in R 3.3.2 on Ubuntu 16.10

I'm using R 3.3.2 and Ubuntu 16.10. I'm unable to install rgl and rgdal packages.
When I use
install.packages("rgl")
gives the following error message:
configure: error: X11 not found but required, configure aborted.
ERROR: configuration failed for package ‘rgl’
When I use
install.packages("rgdal")
gives the following error message:
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘rgdal’
Edited
When I use
sudo apt-get install r-cran-rgl
in Ubuntu Terminal, it says
r-cran-rgl is already the newest version (0.95.1441-2)
However, the latest version of rgl is 0.96.0.
When I use
sudo apt-get install libgdal-dev libgeos++-dev
it throws the following error:
The following packages have unmet dependencies:
libgdal-dev : Depends: libopenjp2-7-dev but it is not going to be installed
I found a solution that was useful for me here: http://robinlovelace.net/r/2013/11/26/installing-rgdal-on-ubuntu.html.
In short, the solution would be this tree command lines:
sudo apt-get install aptitude # install aptitude as an alternative to apt-get
sudo aptitude install libgdal-dev # install the package (you may have to respond to queries here)
sudo aptitude install libproj-dev # install the proj.4 projection library
For rgl, just do sudo apt-get install r-cran-rgl.
For rgdal, follow the recommendation of the spatial folks eg here for sf and do this
add ubuntugis-unstable to the package repositories (e.g. with sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable and then sudo apt-get install libgdal-dev libgeos++-dev)
For general 'R on Ubuntu or Debian' questions, go to the r-sig-debian list.
Edit: Note that you don't need need ubuntugis-unstable repo if the current/older libgdal, libproj4 versions are good enough for you. Those are in the Ubuntu distro so just do sudo apt-get install ....
These installations worked for me provided that, in addition, I installed libxerces-c28. The need for the related shared object was indicated in the error log the first time I tried, after doing the installations indicated (libgdal, libgdal-dev, etc)

how to install R packages "RNetCDF" and "ncdf" on Ubuntu?

I would like to use the R packages RNetCDF and ncdf in Ubuntu.
When I try install.packages('RNetCDF') or install.packages('ncdf'), I get similar errors:
...
ncdf.c:3:20: fatal error: netcdf.h: No such file or directory
compilation terminated.
make: *** [ncdf.o] Error 1
ERROR: compilation failed for package ‘ncdf’
...
Warning message:
In install.packages("ncdf") :
installation of package ‘ncdf’ had non-zero exit status
The packages libnetcdf6 and netcdf-bin from the Ubuntu repository are installed. Do I need to do something else?
You need to install the -dev of those packages to get the headers that are required to compile the package. In this case, you need libnetcdf-dev, udunits-bin and libudunits2-dev
In my case, libudunits2-dev package was needed.
sudo apt-get install libudunits2-dev
Since I installed NetCDF from source, I had to manually specify the locations of lib and include folders
install.packages("/home/user/Downloads/RNetCDF_1.6.1-2.tar.gz",
repos = NULL,
type="source",
dependencies=FALSE,
configure.args="--with-netcdf-include=/usr/local/netcdf-4.2.1-build/include --with-netcdf-lib=/usr/local/netcdf-4.2.1-build/lib")
Just to clarify, since your initial issue is in R, and the fix is applied outside of R. I initially was trying to do
install.packages("libnetcdf-dev"), which didn't work.
instead, from outside of R: sudo apt-get install libnetcdf-dev
That fixed it for me.
In Ubuntu 20.04 LTS one can install the ncdf4 package (which supersedes ncdf), including all dependencies, with the bash command sudo apt install r-cran-ncdf4. Similarly for RNetCDF you can use sudo apt install r-cran-rnetcdf.

Resources