adding RMySQL package to R fails (on Windows)?

2020-01-27 04:00发布

I can't figure out why my RMySQL package won't install - here's what I get:

> install.packages('RMySQL',type='source')
trying URL 'http://cran.mirrors.hoobly.com/src/contrib/RMySQL_0.7-5.tar.gz'
Content type 'application/x-gzip' length 160769 bytes (157 Kb)
opened URL
downloaded 157 Kb

* installing *source* package 'RMySQL' ...
ERROR: configuration failed for package 'RMySQL'
* removing 'C:/PROGRA~1/R/R-212~1.0/library/RMySQL'

The downloaded packages are in '(foo)'

Warning message:
In install.packages("RMySQL", type = "source") : installation of package 'RMySQL' had    non-zero exit status

I don't think it's a problem with the MySQL install, as the right values seem to be in the registry:

> Sys.getenv('MYSQL_HOME')
                 MYSQL_HOME "C:/PROGRA~1/MySQL/MYSQLS~1.1/" 
> readRegistry("SOFTWARE\\MySQL AB", hive="HLM", maxdepth=2)
$`MySQL Server 5.1`
$`MySQL Server 5.1`$DataLocation
[1] "C:\\Documents and Settings\\All Users\\Application Data\\MySQL\\MySQL Server 5.1\\"

$`MySQL Server 5.1`$FoundExistingDataDir 
[1] "0"

$`MySQL Server 5.1`$Location 
[1] "C:\\Program Files\\MySQL\\MySQL Server 5.1\\"

$`MySQL Server 5.1`$Version
[1] "5.1.54"

Puzzled. Any help would be greatly appreciated!

11条回答
老娘就宠你
2楼-- · 2020-01-27 04:20

First I would try following the directions on this page: http://biostat.mc.vanderbilt.edu/wiki/Main/RMySQL

Then, ensure that you actually have a MySQL client on your computer, not just the server itself. I've had a problem myself where I had to use an older binary for the client, but you can download these from mysql website.

查看更多
乱世女痞
3楼-- · 2020-01-27 04:20

Following worked for me in red hat linux

wget http://cran.r-project.org/src/contrib/RMySQL_0.9-3.tar.gz
sudo R CMD INSTALL  --configure-args='--with-mysql-inc=/usr/include/mysql' --configure-args='--with-mysql-lib=/usr/lib64/mysql' RMySQL_0.9-3.tar.gz
查看更多
啃猪蹄的小仙女
4楼-- · 2020-01-27 04:23

I created a binary which might work for people:

http://kenahoo.blogspot.com/2011/09/rmysql-binary-for-windows-7.html

I basically followed all these directions, including the ones at the Vanderbilt page, but for one reason or another it doesn't always seem to work. Anyway, hope this might be helpful for people who have the same versions of stuff I used.

查看更多
姐就是有狂的资本
5楼-- · 2020-01-27 04:25

I was having this same problem on Windows 7 with R 2.12.1 x64 and resolved it by:

  1. Changing the R directory in my PATH variable to C:\Program Files\R\R-2.12.1\bin\x64 (rather than just ...\R-2.12.1\bin).
  2. Copying ...\MySQL Server 5.5\lib\libmysql.dll to ...\MySQL Server 5.5\bin\.
  3. Running R CMD INSTALL RMySQL_0.7-5.tar.gz in cmd.exe (install.packages('RMySQL',type='source') in R still would not work).
查看更多
孤傲高冷的网名
6楼-- · 2020-01-27 04:29

As Marek said. There is no windows binary for this package. I had similar troubles on my Mac when I tried to install RPostgreSQL (because there's no binary for Mac) in the end I had to compile it on my own and modify several files.

For the MySQL part(if you don't know much about MySQL), you might want to use WAMP which is admittedly more than you need, but easy to install and to start and shut down.

For some compiling help you might be interested in Rtools

HTH

BTW: What kind of windows do you run (sry, if I missed it)

查看更多
爱情/是我丢掉的垃圾
7楼-- · 2020-01-27 04:31

Add MySQL and RTools directory to the PATH!

Here is my PATH ; ~blah~;C:\Program Files\MySQL\MySQL Server 5.5\bin;c:\rtools\bin;C:\Rtools\gcc-4.6.3\bin;

查看更多
登录 后发表回答