How to solve the error " missing required header GL/gl.h" while installing the Package mvoutlier in R? - 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.

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

How to install Rmpfr on Ubuntu 18.04?

After install.packages("Rmpfr") I'm getting this error
configure: error: Header file mpfr.h not found; maybe use
--with-mpfr-include=INCLUDE_PATH
ERROR: configuration failed for package ‘Rmpfr’
I typed the suggestion --with-mpfr-include=INCLUDE_PATH into the terminal w/o success.
Look here: https://github.com/cran/Rmpfr
You first have to install the dependend libraries.
sudo apt-get install libmpfr-dev
sudo su - -c "R -e \"install.packages('Rmpfr', repos='http://cran.rstudio.com/')\""
It is also a better solution to install the R-Packages from the console, not inside R, since every user on the machine will have access to the package then. Otherwise it will just be in your personal library.

R package Rmpfr

I am trying to install Rmpfr in a Ubuntu machine. But I kept getting the following error.
configure: error: Header file mpfr.h not found; maybe use --with-mpfr-include=INCLUDE_PATH
ERROR: configuration failed for package ‘Rmpfr’
Could anyone help me with this, please? Thank you.
You need mpfr.h which you get from
sudo apt-get install libmpfr-dev
This recipe is generic: you need the (Linux) -dev package for compilation against a (Linux) library which is what the (R) package does here.

Unable to install rJava on R platform

I have Ubuntu 10.x OS and I have installed R on it. I want to install rJava on R. For that when I am running installed.packages("rJava) command which is giving error
checking whether Java run-time works... Error: Could not find or load main class getsp
no
configure: error: Java interpreter '/usr/bin/java' does not work
ERROR: configuration failed for package ‘rJava’
* removing ‘/home/hduser/R/i486-pc-linux-gnu-library/2.10/rJava’
The downloaded packages are in
‘/tmp/Rtmp0tlBXn/downloaded_packages’
Warning message:
In install.packages("rJava") :
installation of package 'rJava' had non-zero exit status
If I run system("java -version")
Then it showing same Java version which is given when I run Java -version command from base OS prompt. So it means no problem with Java which I can see reason in output of install package command? As suggested when I use
sudo apt-get install r-cran-rjava
Here also didnt get any luck
Please suggest
I just saw that you wrote installed.packages instead of install.packages, you have to use install.packages("rJava") to install it.
The description of the method you used (installed.packages) says: Find (or retrieve) details of all packages installed in the specified libraries.
Can you please try
install.packages("rJava")
library(rJava)
and tell me the output? (I'm pretty sure it will already work then).
in the terminal run sudo apt-get install default-jdk
then run sudo R CMD javareconf
after that you can continue in R or Rstudio install.packages("rJava")

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