Problem to install package RMySQL / Ubuntu 18.04 - r

R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.4 LTS
When I try install the package RMySQL using the following command:
install.packages('RMySQL')
I got the following error message:
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'RMySQL.so' failed
make: *** [RMySQL.so] Error 1
ERROR: compilation failed for package ‘RMySQL’
* removing ‘/home/lepina/R/x86_64-pc-linux-gnu-library/3.6/RMySQL’
Warning in install.packages :
installation of package ‘RMySQL’ had non-zero exit status
I ask help because I don't know what else I might to do. I have already performed a R downgrade from 4.0.0 to 3.6.3 without success.
Following the recommendation from Dirk Eddelbuettel, and I run the following command line:
sudo apt-get install r-cran-rmysql
But I get another error message:
:~$ sudo apt-get install r-cran-rmysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
r-cran-rmysql : Depends: r-api-3.4
Depends: r-cran-dbi (>= 0.4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
So I decided to fix the broken packages, using the couple of commands:
sudo apt update --fix-missing
sudo apt install -f
And forcing the manual installation of missing package r-api-3.4, using the command:
sudo apt-get install -y r-api-3.4
But I got another error message that I don't have ideia about how to solve it:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package r-api-3.4 is a virtual package provided by:
r-base-core 3.4.4-1ubuntu1 [Not candidate version]
E: Package 'r-api-3.4' has no installation candidate

To make it visible for everybody else: Dirk's solution via terminal worked for me (Ubuntu 22.04): sudo apt-get install r-cran-rmysql

Related

Installing systemfonts package from CRAN and GitHub fails

I recently upgraded my intel MacBook from Catalina to Monterey (Darwin release 21.1.0) I also upgraded R from 4.0.1 to 4.1.1 via home-brew. I have reinstalled the majority of packages necessary for my work, however, ran into issues with mapview. It failed to install due to an issue with a dependency - systemfonts. I attempted to install systemfonts directly from CRAN and after that failed from GitHub which also failed with these messages:
/bin/sh: I/usr/local/Cellar/r/4.1.1_1/lib/R/include: No such file or directory
make: [mac/FontManagerMac.o] Error 127 (ignored)
and
clang: error: no such file or directory: 'mac/FontManagerMac.o'
make: *** [systemfonts.so] Error 1
ERROR: compilation failed for package ‘systemfonts’
* removing ‘/usr/local/lib/R/4.1/site-library/systemfonts’
Warning message:
In i.p(...) :
installation of package ‘/var/folders/85/56q39hqj2_gf31m9mbln7hhw0000gn/T//RtmpJGiNgA/file324134b404c/systemfonts_1.0.3.9000.tar.gz’ had non-zero exit status
I'd appreciate any thoughts on this issue. I may open an issue on GitHub r-lib/systemfonts as this may be related to some sort of incompatibility between the package and the updated OS however, thought I should start here.
Thanks
The solution listed in the issue from #Kevin_Cazelles linked to worked on my computer. Seems like it has something to do with gcc and R's call for the compiler.
This worked for me:
brew reinstall gcc
brew link --overwrite gcc
and then this in R-studio terminal
withr::with_makevars(c(OBJCXX = "gcc"), install.packages('systemfonts'))
In the bash shell:
sudo apt install libfontconfig1-dev
in RStidio
install.packages("systemfonts", dependencies = TRUE)

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

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.

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