2
votes

I've been attempting to install RMySQL in RStudio for quite some time now. I've installed the DBI dependency and have attempted to install RMySQL with the following error:

Configuration error: could not find the MySQL installation include and/or library directories. Manually specify the location of the MySQL libraries and the header files and re-run R CMD INSTALL.

INSTRUCTIONS:

  1. Define and export the 2 shell variables PKG_CPPFLAGS and PKG_LIBS to include the directory for header files (*.h) and libraries, for example (using Bourne shell syntax):

    export PKG_CPPFLAGS="-I" export PKG_LIBS="-L -lmysqlclient"

    Re-run the R INSTALL command:

    R CMD INSTALL RMySQL_.tar.gz

  2. Alternatively, you may pass the configure arguments --with-mysql-dir= (distribution directory) or --with-mysql-inc= (where MySQL header files reside) --with-mysql-lib= (where MySQL libraries reside) in the call to R INSTALL --configure-args='...'

    R CMD INSTALL --configure-args='--with-mysql-dir=DIR' RMySQL_.tar.gz

ERROR: configuration failed for package ‘RMySQL’ * removing ‘/home/zlau/R/i686-pc-linux-gnu-library/2.14/RMySQL’ Warning in install.packages : installation of package ‘/home/zlau/R/i686-pc-linux-gnu-library/2.14/RMySQL_0.9-3.tar.gz’ had non-zero exit status

This is a common error that is said to be resolved by installing the following package from the Ubuntu command line: libmysqlclient-dev (or some version of it). I've attempted several times to install with "sudo apt-get install libmysqlclient-dev" Each time I receive the following error a 404 not found error for the following...

http://archive.ubuntu.com/ubuntu/precise-updates/main libmysqlclient-dev i386 5.5.32-0ubuntu0.12.04.1

If anyone can help, it would be much appreciated. I cannot post images yet.

1

1 Answers

2
votes

This has nothing to do with R or MySQL. You have a configuration error in your Ubuntu APT sources (the configuration of the repositories). I'm no expert on APT, so forgive me if I'm not getting the details right, but I think I can put you on the right track. If I execute:

sudo apt-get install libmysqlclient-dev

on my machine with Ubuntu 12.04 on it, then one of the lines I see is:

Get:1 http://es.archive.ubuntu.com/ubuntu/ precise-updates/main libmysqlclient-dev amd64 5.5.37-0ubuntu0.12.04.1 [1,397 kB]

Note how there is a space before "precise-updates/main". In my "/etc/apt/sources.list" file I have entries like:

deb http://es.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://es.archive.ubuntu.com/ubuntu/ precise main restricted

Also with a space before "precise". Why don't you check your sources.list file...