installing RMySQL package on Mac Catallina - r

I tried to install RMySQL package in my Rstudio, and when I tried it, it gave me following error
> install.packages("RMySQL")
Installing package into ‘/Users/haeseongmoon/Library/R/3.6/library’
(as ‘lib’ is unspecified)
Warning in install.packages :
unable to access index for repository https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6:
cannot open URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/PACKAGES'
Package which is only available in source form, and may need compilation of
C/C++/Fortran: ‘RMySQL’
Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
installing the source package ‘RMySQL’
trying URL 'https://cran.rstudio.com/src/contrib/RMySQL_0.10.20.tar.gz'
Content type 'application/x-gzip' length 52900 bytes (51 KB)
==================================================
downloaded 51 KB
* installing *source* package ‘RMySQL’ ...
** package ‘RMySQL’ successfully unpacked and MD5 sums checked
** using staged installation
Using PKG_CFLAGS=
Using PKG_LIBS=-lmysqlclient
-----------------------------[ ANTICONF ]-----------------------------
Configure could not find suitable mysql/mariadb client library. Try installing:
* deb: libmariadbclient-dev | libmariadb-client-lgpl-dev (Debian, Ubuntu)
* rpm: mariadb-connector-c-devel | mariadb-devel | mysql-devel (Fedora, CentOS, RHEL)
* csw: mysql56_dev (Solaris)
* brew: mariadb-connector-c (OSX)
If you already have a mysql client library installed, verify that either
mariadb_config or mysql_config is on your PATH. If these are unavailable
you can also set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------[ ERROR MESSAGE ]----------------------------
<stdin>:1:10: fatal error: 'mysql.h' file not found
#include <mysql.h>
^~~~~~~~~
1 error generated.
-----------------------------------------------------------------------
ERROR: configuration failed for package ‘RMySQL’
* removing ‘/Users/haeseongmoon/Library/R/3.6/library/RMySQL’
Warning in install.packages :
installation of package ‘RMySQL’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/c6/qgbzrx0s4zq7gdbhzz43gqhw0000gn/T/RtmpOozjqL/downloaded_packages’
I tried various solutionns that I found while I was doing googling, but it didn't workout.
How can I install RMySQL?

Thankfully, the error tells you exactly what to do.
Configure could not find suitable mysql/mariadb client library. Try installing:
* deb: libmariadbclient-dev | libmariadb-client-lgpl-dev (Debian, Ubuntu)
* rpm: mariadb-connector-c-devel | mariadb-devel | mysql-devel (Fedora, CentOS, RHEL)
* csw: mysql56_dev (Solaris)
* brew: mariadb-connector-c (OSX)
You need to use homebrew to install mariadb-connector-c.
brew install mariadb-connector-c
If you don't have homebrew yet, check out this page.

Related

Cannot install httr package in R 3.6.2 in Linux Mint 19.3

I am totally new to R.
I tried to install the httr package.
I first installed pacman, and then tried to load httr through it by running pacman::p_load(httr).
It wasn't successful. And it showed the following message in terminal-
Installing package into
‘/home/|username|/R/x86_64-pc-linux-gnu-library/3.6’ (as ‘lib’ is
unspecified) also installing the dependencies ‘curl’, ‘openssl’
trying URL 'https://cloud.r-project.org/src/contrib/curl_4.3.tar.gz'
Content type 'application/x-gzip' length 673779 bytes (657 KB)
================================================== downloaded 657 KB
trying URL
'https://cloud.r-project.org/src/contrib/openssl_1.4.1.tar.gz' Content
type 'application/x-gzip' length 1206885 bytes (1.2 MB)
================================================== downloaded 1.2 MB
trying URL 'https://cloud.r-project.org/src/contrib/httr_1.4.1.tar.gz'
Content type 'application/x-gzip' length 158465 bytes (154 KB)
================================================== downloaded 154 KB
installing source package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
** using staged installation 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
containinglibcurl.pc' to the PKG_CONFIG_PATH environment variable No
package 'libcurl' found Using PKG_CFLAGS= Using PKG_LIBS=-lcurl
------------------------- ANTICONF ERROR --------------------------- Configuration failed because libcurl was not found. Try installing: *
deb: libcurl4-openssl-dev (Debian, Ubuntu, etc) * rpm: libcurl-devel
(Fedora, CentOS, RHEL) * csw: libcurl_dev (Solaris) If libcurl is
already installed, check that 'pkg-config' is in your PATH and
PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config is
unavailable you can set INCLUDE_DIR and LIB_DIR manually via: R CMD
INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------------------------------------------------- ERROR: configuration failed for package ‘curl’
removing ‘/home/|username|/R/x86_64-pc-linux-gnu-library/3.6/curl’
installing source package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
** using staged installation Using PKG_CFLAGS=
------------------------- ANTICONF ERROR --------------------------- Configuration failed because openssl was not found. Try installing: *
deb: libssl-dev (Debian, Ubuntu, etc) * rpm: openssl-devel (Fedora,
CentOS, RHEL) * csw: libssl_dev (Solaris) * brew: openssl#1.1 (Mac
OSX) If openssl is already installed, check that 'pkg-config' is in
your PATH and PKG_CONFIG_PATH contains a openssl.pc file. If
pkg-config is unavailable you can set INCLUDE_DIR and LIB_DIR manually
via: R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------------------------------------------------- ERROR: configuration failed for package ‘openssl’
removing ‘/home/|username|/R/x86_64-pc-linux-gnu-library/3.6/openssl’ ERROR: dependencies ‘curl’, ‘openssl’ are not available for package
‘httr’
removing ‘/home/|username|/R/x86_64-pc-linux-gnu-library/3.6/httr’
The downloaded source packages are in
‘/tmp/Rtmp3wZaOu/downloaded_packages’ Warning messages: 1: In
utils::install.packages(package, ...) : installation of package
‘curl’ had non-zero exit status 2: In utils::install.packages(package,
...) : installation of package ‘openssl’ had non-zero exit status 3:
In utils::install.packages(package, ...) : installation of package
‘httr’ had non-zero exit status 4: In p_install(package,
character.only = TRUE, ...) : 5: In library(package, lib.loc =
lib.loc, character.only = TRUE, logical.return = TRUE, : there is
no package called ‘httr’ 6: In pacman::p_load(httr) : Failed to
install/load: httr
How do I solve this?
Note: I have installed several other external packages through pacman. Like- dplyr, ggplot2 etc.
httr imports openssl (https://cran.r-project.org/web/packages/openssl/index.html) and curl (https://cran.r-project.org/web/packages/curl/index.html)
and both are specific system requirements. For openssl "SystemRequirements: OpenSSL >= 1.0.1" and for curl "SystemRequirements: libcurl: libcurl-devel (rpm) or libcurl4-openssl-dev (deb)."

curl package not available for several R packages

I just installed ubunutu 18.04 and I successfully install R version 3.5.1. I am having problems installing R packages such as plotly. It seems that the packages curl and httr are not available. The full error message:
> install.packages("plotly")
Installing package into ‘/home/lualeperez/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
also installing the dependencies ‘curl’, ‘openssl’, ‘httr’
trying URL 'https://cloud.r-project.org/src/contrib/curl_3.2.tar.gz'
Content type 'application/x-gzip' length 367047 bytes (358 KB)
==================================================
downloaded 358 KB
trying URL 'https://cloud.r-project.org/src/contrib/openssl_1.0.2.tar.gz'
Content type 'application/x-gzip' length 1194883 bytes (1.1 MB)
==================================================
downloaded 1.1 MB
trying URL 'https://cloud.r-project.org/src/contrib/httr_1.3.1.tar.gz'
Content type 'application/x-gzip' length 147593 bytes (144 KB)
==================================================
downloaded 144 KB
trying URL 'https://cloud.r-project.org/src/contrib/plotly_4.8.0.tar.gz'
Content type 'application/x-gzip' length 1860673 bytes (1.8 MB)
==================================================
downloaded 1.8 MB
* 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
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
* deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
* rpm: libcurl-devel (Fedora, CentOS, RHEL)
* csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘curl’
* removing ‘/home/lualeperez/R/x86_64-pc-linux-gnu-library/3.5/curl’
* installing *source* package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
Using PKG_CFLAGS=
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because openssl was not found. Try installing:
* deb: libssl-dev (Debian, Ubuntu, etc)
* rpm: openssl-devel (Fedora, CentOS, RHEL)
* csw: libssl_dev (Solaris)
* brew: openssl#1.1 (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘openssl’
* removing ‘/home/lualeperez/R/x86_64-pc-linux-gnu-library/3.5/openssl’
ERROR: dependencies ‘curl’, ‘openssl’ are not available for package ‘httr’
* removing ‘/home/lualeperez/R/x86_64-pc-linux-gnu-library/3.5/httr’
ERROR: dependency ‘httr’ is not available for package ‘plotly’
* removing ‘/home/lualeperez/R/x86_64-pc-linux-gnu-library/3.5/plotly’
The downloaded source packages are in
‘/tmp/RtmpNTZBPJ/downloaded_packages’
Warning messages:
1: In install.packages("plotly") :
installation of package ‘curl’ had non-zero exit status
2: In install.packages("plotly") :
installation of package ‘openssl’ had non-zero exit status
3: In install.packages("plotly") :
installation of package ‘httr’ had non-zero exit status
4: In install.packages("plotly") :
installation of package ‘plotly’ had non-zero exit status
I tried to solve the problem by installing libcurl4 by doing
sudo apt-get install libcurl4
but the systems then removes all the r-base dependencies.
I haven't tried to solve the problem with the httr package.
Does any one have any hint on how to solve this problem?
Just ran into the same issue, this is the solution I found:
Since just installing libcurl4-openssl-dev removes all the r-base packages what I did was
sudo apt-get install libcurl4-openssl-dev r-base
and afterwards
R -q -e "install.packages(c('curl'))"
and it worked.
Only caveat is that it upgrades your R version, but if you are already using the latest one then its not an issue.
You are attempting to compile from source. That sometimes has so-called build dependencies. You are missing them, and you are overlooking the (somewhat clear) error messages to that extend because you are getting swamped by multiple installations.
So first tip, so it one package at a time.
Second tip: realize that many (if not all) of these are available within Ubuntu. So just do
sudo apt install r-cran-curl
to install e.g. curl. Ditto for the others.
Third tip: There are over 3000 CRAN packages for Ubuntu at Michael's PPA. Read the top of
this README and then go this PPA (provided you want 3.5 which you do).
Fedora 36:
dnf install cmake
dnf install openssl-devel
dnf install libcurl-devel.x86_64

Cannot Install RMySQL on CENTOS

I am finding it very difficult to install the "RMySQL" package on CENTOS.
install.packages("RMySQL", dependencies = TRUE, repos = "http://cran.rstudio.com/")
The error it is throwing me is:
* installing *source* package ‘RMySQL’ ...
** package ‘RMySQL’ successfully unpacked and MD5 sums checked
Using PKG_CFLAGS=
Using PKG_LIBS=-lmysqlclient
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libmysqlclient was not found. Try installing:
* deb: libmariadb-client-lgpl-dev (Debian, Ubuntu 16.04)
libmariadbclient-dev (Ubuntu 14.04)
* rpm: mariadb-devel | mysql-devel (Fedora, CentOS, RHEL)
* csw: mysql56_dev (Solaris)
* brew: mariadb-connector-c (OSX)
If libmysqlclient is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libmysqlclient.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘RMySQL’
* removing ‘/usr/local/lib64/R/library/RMySQL’
The downloaded source packages are in
‘/tmp/RtmpbFMPmO/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("RMySQL", dependencies = TRUE, repos = "http://cran.rstudio.com/") :
installation of package ‘RMySQL’ had non-zero exit status
I have already installed yum update mysql-devel but still get the same error.
Any help will be appreciated as I have been trying to figure his out since last 2 days.

Error when installing swirl in RStudio 3.1.2

Hey I tried installing swirl running the following command:
install.packages("swirl")
I got the following error:
------------------------- ANTICONF ERROR ------------------------- --
Configuration failed because libcurl was not found. Try installing:
* deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
* rpm: libcurl-devel (Fedora, CentOS, RHEL)
* csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘curl’
* removing ‘/home/franco/R/x86_64-pc-linux-gnu-library/3.1/curl’
Warning in install.packages :
installation of package ‘curl’ had non-zero exit status
* installing *source* package ‘RCurl’ ...
** package ‘RCurl’ successfully unpacked and MD5 sums checked
checking for curl-config... no
Cannot find curl-config
ERROR: configuration failed for package ‘RCurl’
* removing ‘/home/franco/R/x86_64-pc-linux-gnu-library/3.1/RCurl’
Warning in install.packages :
installation of package ‘RCurl’ had non-zero exit status
ERROR: dependency ‘curl’ is not available for package ‘httr’
* removing ‘/home/franco/R/x86_64-pc-linux-gnu-library/3.1/httr’
Warning in install.packages :
installation of package ‘httr’ had non-zero exit status
ERROR: dependencies ‘httr’, ‘RCurl’ are not available for package ‘swirl’
* removing ‘/home/franco/R/x86_64-pc-linux-gnu-library/3.1/swirl’
Warning in install.packages :
installation of package ‘swirl’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmp7G87EM/downloaded_packages’
I tried installing "curl" and "RCurl" packages but I got the same error messages. I don't know how to change the path as directed in the ANTICONF ERROR.
I'm running Ubuntu 15.04 and R version 3.1.2 (2014-10-31)
now it's
sudo apt-get install libcurl4-gnutls-dev
Updated as on 30-05-2019:
I am using Ubuntu 16.04
I got this while installing the packages-
Using PKG_CFLAGS=
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because openssl was not found. Try installing: *
deb: libssl-dev (Debian, Ubuntu, etc) * rpm: openssl-devel (Fedora,
CentOS, RHEL) * csw: libssl_dev (Solaris) * brew: openssl#1.1 (Mac
OSX) If openssl is already installed, check that 'pkg-config' is in
your PATH and PKG_CONFIG_PATH contains a openssl.pc file. If
pkg-config is unavailable you can set INCLUDE_DIR and LIB_DIR manually
via: R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
I used the command in terminal >
sudo apt-get install libssl-dev
And then it worked fine.

Failed install R package RMySQL on CentOS 6.5 "because mysql-connector-c was not found"

I'm installing RMySQL within R terminal under CentOS 6.5 but received the following error message:
* installing to library ‘/usr/lib64/R/library’
* installing *source* package ‘RMySQL’ ...
** 成功将‘RMySQL’程序包解包并MD5和检查
Found INCLUDE_DIR and/or LIB_DIR!
Using PKG_CFLAGS=-I/usr/local/lib64/R/include/include
Using PKG_LIBS=-L/usr/local/lib64/R/lib -lmysqlclient -lz
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because mysql-connector-c was not found. Try installing:
* deb: libmysqlclient-dev | libmariadbclient-dev (Debian, Ubuntu)
* rpm: mariadb-devel | mysql-devel (Fedora, CentOS, RHEL)
* csw: mysql56_dev (Solaris)
* brew: mysql-connector-c (OSX)
If mysql-connector-c is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a mysql-connector-c.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘RMySQL’
* removing ‘/usr/lib64/R/library/RMySQL’
Here's additional info:
I've installed mysql-devel as required through yum
PKG_CONFIG_PATH has been set to "/usr/lib64/pkgconfig:/usr/share/pkgconfig:/usr/local/lib/pkgconfig" however I'm unable to locate the file "mysql-connector-c.pc" on the entire system.
I've been stuck here for 2 days and would really appreciate your help and advice! Thank you!
You can search for mysql-connector-c at http://rpm.pbone.net/ to get an overview.
Note that no mysql-connector-c packages are available for CentOS. Only appears when searching Redhat EL6 and EL7.
Also be aware that none of the "mysql-connector-c-devel" packages seems to have a file "mysql-connector-c.pc"

Resources