Error installing rgdal: API to be used not found - r

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

Related

When attempting to install tidyverse in R studio on fedora tidyverse's dependencies wont install

Warning in install.packages :
installation of package ‘googledrive’ had non-zero exit status
ERROR: dependencies ‘curl’, ‘gargle’, ‘googledrive’, ‘httr’, ‘ids’ are not available for package ‘googlesheets4’
* removing ‘/home/lanewhitten/R/x86_64-redhat-linux-gnu-library/4.0/googlesheets4’
Warning in install.packages :
installation of package ‘googlesheets4’ had non-zero exit status
ERROR: dependencies ‘googledrive’, ‘googlesheets4’, ‘httr’, ‘rvest’ are not available for package ‘tidyverse’
* removing ‘/home/lanewhitten/R/x86_64-redhat-linux-gnu-library/4.0/tidyverse’
Warning in install.packages :
installation of package ‘tidyverse’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpxCRrL7/downloaded_packages’
That is the tail of my error messages. Ive already installed curl on fedora using
sudo dnf install curl
I am at a total loss as to how to resolve this and switching operating systems or running a virtual machine is not an option for me.
The development packages which are not specified in the error message need to be installed
sudo dnf install libcurl-devel
sudo dnf install openssl-devel
then do install.packages("tidyverse")
This will make your R experience on Fedora much easier
Unfortunately, CRAN does not provide binaries for Linux. That is why, by default install.packages() will compile any package you install from source. Many packages require developer libraries to be installed on the system for compilation. The lack of these packages is why you got the error.
Overall, compiling packages yourself is far from ideal. All packages will take a longer time to install. Especially when you do them infrequently, updates will take an eternity. Also, finding out which system developer packages to install alongside can be time consuming as well, particularly for beginners.
Luckily, there is a COPR repository for Fedora that provides up-to-date binaries for all CRAN packages. All you have to do is run these few lines in the system terminal (not R console):
sudo dnf install 'dnf-command(copr)'
sudo dnf copr enable iucar/cran
sudo dnf install R-CoprManager
Afterwards install.packages() in R will install the desired packages through the system package manager. This also means that you will receive R package updates whenever you run dnf update or update the system with your desktop environments software management GUI.
You can find further documentation about this on the CRAN website.

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.

ERROR: configuration failed for package ‘gifski’

I'd like to use the gganimate package, but it requires gifski which is failing.
* installing *source* package ‘gifski’ ...
** package ‘gifski’ successfully unpacked and MD5 sums checked
------------------ RUST COMPILER NOT FOUND --------------------
Cargo was not found on the PATH. Please install cargo / rustc:
- yum install cargo (Fedora/CentOS)
- apt-get install cargo (Debian/Ubuntu)
- brew install rustc (MacOS)
Alternatively install Rust from: <https://www.rust-lang.org>
---------------------------------------------------------------
ERROR: configuration failed for package ‘gifski’
* removing ‘/home/User/R/x86_64-pc-linux-gnu-library/3.5/gifski’
Warning in install.packages :
installation of package ‘gifski’ had non-zero exit status
It says I need to install Rust, but I've done that. I ran these commands and then rebooted.
curl https://sh.rustup.rs -sSf | sh
export PATH="$HOME/.cargo/bin:$PATH"
I'm on a CentOS Linux machine hosted on EC2.
If you're in linux Ubuntu, first install rust compiler:
terminal > sudo apt-get install cargo
then, install gifski from github:
devtool::install_github("r-rust/gifski")
or using remotes package:
remotes::install_github("r-rust/gifski")
i hope i helped you.

unable to install rvest package

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.

How to solve the error " missing required header GL/gl.h" while installing the Package mvoutlier in R?

I am trying to install the package mvoutlier but following error occurs during installation:
install.packages("mvoutlier")
configure: error: missing required header GL/gl.h
ERROR: configuration failed for package ‘rgl’
* removing ‘/home/sam/R/x86_64-pc-linux-gnu-library /2.15/rgl’
ERROR: dependency ‘rgl’ is not available for package ‘compositions’
* removing ‘/home/sam/R/x86_64-pc-linux-gnu-library/2.15/compositions’
ERROR: dependency ‘compositions’ is not available for package ‘mvoutlier’
* removing ‘/home/sam/R/x86_64-pc-linux-gnu-library/2.15/mvoutlier’
After that I have install the rgl package successfully, then I tried to install the compositions package then the again same error occurs. Then I have again tried to install the mvoutlier package the same error occurs.
Can anyone let me know how I can resolve this problem. Thanking you in advance.
I suspect you are running Ubuntu 12.04.I think you're going to find that this works for the GL/gl.h problem:
install these at the regular old terminal, ie pretend R doesn't exist for now:
libglu1-mesa-dev freeglut3-dev mesa-common-dev
You might get the following error later (in R) because of a tcl b****/gripe/complaint:
Error in structure(.External(.C_dotTcl, ...), class = "tclObj") :
[tcl] can't find package BWidget.
To fix this problem, if you have it:
sudo apt-get install bwidget
These are not R problems. They are OS problems!
I ran into the same issue in between others on a Ubuntu based Linux distro (Linux Mint). Here I will share the worklog I'd done to fix it.
The full fix was:
apt-get install libx11-dev mesa-common-dev libglu1-mesa-dev
Worklog
The first error was related to missing devel libraries of X11:
configure: error: X11 not found but required, configure aborted.
I fixed it installing:
apt-get install libx11-dev
However, after fix the issue, I felt into a new one like this one:
configure: error: missing required header GL/gl.h
ERROR: configuration failed for package ‘rgl’
I checked the library on the repository:
# dpkg -S /usr/include/GL/gl.h
dpkg-query: no path found matching pattern /usr/include/GL/gl.h
To fix this issue, install :
apt-get install mesa-common-dev
Then, I was prompt by a new error:
configure: error: missing required header GL/glu.h
To fix the issue, install the libglu1 devel libraries:
apt-get install libglu1-mesa-dev
configure: error: missing required header GL/gl.h
normally means you haven't installed the -dev version of a package, in this case GL.
On my system, GL/gl.h is owned by mesa-common-dev
$ dpkg -S /usr/include/GL/gl.h
mesa-common-dev: /usr/include/GL/gl.h
which would have been installed with apt-get install mesa-common-dev or via some GUI magic.
On Ubuntu 16.04, I solved this problem (during rgl package installation) with sudo apt-get install libglu1-mesa-dev
the current fedora package manager will fail to find these libraries as shown. Instead you need to do
sudo dnf install mesa-libGL-devel mesa-libGLU-devel
Based on the work breakdown by 3manuek, I figured only the libglu1-mesa-dev library was needed in ubuntu 16.04 LTS, and it worked.
On, RHEL, sudo yum install mesa-libGLU-devel worked.
I encountered an equivalent problem when testing a package that required 'rgl' on Travis. The problem is that the operating system lacks the necessary GL files on which the 'rgl' package draws.
A thread at R-forge offers the ingenious solution of running apt-get install r-cran-rgl, which will pull in any of the GL dependencies not already present on the operating system. This seems simpler than second-guessing which specific dependency is missing, and it remains possible to install a more recent version of 'rgl' if required.

Resources