install RMySQL on windows - r

I am trying to install the package RMYSQL on windows.
To do so i followed this tutorial : http://www.ahschulz.de/2013/07/23/installing-rmysql-under-windows/
But i am getting an error when i execute
install.packages(“RMySQL”, type = “source”)
In deed R returns me the following :
Installing package into ‘D:/Users/quentin/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/RMySQL_0.9-3.tar.gz'
Content type 'application/x-gzip' length 165363 bytes (161 Kb) opened URL
downloaded 161 Kb
* installing *source* package 'RMySQL' ...
** package 'RMySQL' correctement décompressé et sommes MD5 vérifiées
checking for $MYSQL_HOME... C:/Program Files (x86)/MySQL/mysql-5.6.19-win32
cygwin warning:
MS-DOS style path detected: C:/Program
Preferred POSIX equivalent is: /cygdrive/c/Program
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
test: Files: unknown operand
** libs
Avis : this package has a non-empty 'configure.win' file,
so building only the main architecture
cygwin warning:
MS-DOS style path detected: C:/PROGRA~1/R/R-31~1.0/etc/x64/Makeconf
Preferred POSIX equivalent is: /cygdrive/c/PROGRA~1/R/R-31~1.0/etc/x64/Makeconf
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
gcc -m64 -I"C:/PROGRA~1/R/R-31~1.0/include" -DNDEBUG -I"C:/Program Files (x86)/MySQL/mysql-5.6.19-win32"/include - I"d:/RCompile/CRANpkg/extralibs64/local/include"
-O2 -Wall -std=gnu99 -mtune=core2 -c
RS-DBI.c -o RS-DBI.o
RS-DBI.c: In function 'RS_na_set':
RS-DBI.c:1219:11: warning: variable 'c' set but not used [-Wunused-but-set-variable]
gcc -m64 -I"C:/PROGRA~1/R/R-31~1.0/include" -DNDEBUG -I"C:/Program Files (x86)/MySQL/mysql-5.6.19-win32"/include - I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall - std=gnu99 -mtune=core2 -c RS-MySQL.c -o RS-MySQL.o
RS-MySQL.c: In function 'RS_MySQL_fetch':
RS-MySQL.c:657:13: warning: variable 'fld_nullOk' set but not used [-Wunused-but-set- variable]
RS-MySQL.c: In function 'RS_DBI_invokeBeginGroup':
RS-MySQL.c:1137:30: warning: variable 'val' set but not used [-Wunused-but-set-variable]
RS-MySQL.c: In function 'RS_DBI_invokeNewRecord':
RS-MySQL.c:1158:20: warning: variable 'val' set but not used [-Wunused-but-set- variable]
RS-MySQL.c: In function 'RS_MySQL_dbApply':
RS-MySQL.c:1219:38: warning: variable 'fld_nullOk' set but not used [-Wunused-but-set- variable]
gcc -m64 -shared -s -static-libgcc -o RMySQL.dll tmp.def RS-DBI.o RS-MySQL.o C:/Program Files (x86)/MySQL/mysql-5.6.19-win32/bin/libmySQL.dll - Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-31~1.0/bin/x64 -lR
collect2: ld returned 5 exit status
aucune DLL n'a pas été créé
ERROR: compilation failed for package 'RMySQL'
* removing 'D:/Users/quentin/Documents/R/win-library/3.1/RMySQL'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-31~1.0/bin/x64/R" CMD INSTALL -l "D:\Users\quentin\Documents\R\win-library\3.1" D:\Users\quentin\AppData\Local\Temp\2\RtmpOwB1UH/downloaded_packages/RMySQL_0.9-3.tar.gz' had status 1
Warning in install.packages :
installation of package ‘RMySQL’ had non-zero exit status
The downloaded source packages are in
‘D:\Users\quentin\AppData\Local\Temp\2\RtmpOwB1UH\downloaded_packages’
I couldn't manage to fix this problem so if someone have an idea.

i tried all the steps from all the instructions i could get, but still got the same problems as you got.
I finallly solved accidently by follow this code:
install.packages('RMySQL')
instead of
install.packages(“RMySQL”, type = “source”)
I cannot explain the reason, but it truly works.

I solved it by installing from a .zip file not from .tar.gz.
Make sure your MYSQL_HOME environment variable is set correctly and libmysql.dll is copied to bin folder!!!
Run install.packages('RMySQL') then when the "Do you want to install from sources..." window pops up select No.
Then copy the downloaded binary packages location from console.
Go to Packages -> Install, paste the location into Package archive and click Install.

Related

R package source install, no compiler

I am trying to install some packages from source on a linux (RHEL) server. But whenever the package requires some C++ compilation it fails.
For example, I try to install Ckmeans.1d.dp package. If I call R CMD INSTALL Ckmeans.1.dp_4.2.1.tar.gz I get the following output (truncated) where you can see the compiler is omitted.
...* installing *source* package ‘Ckmeans.1d.dp’ ...
** libs
I/usr/include/R -DNDEBUG -I/usr/local/include -c Ckmeans.1d.dp.cpp -o Ckmeans.1d.dp.o
make: I/usr/include/R: Command not found
...
-shared -L/usr/local/lib64 -o Ckmeans.1d.dp.so Ckmeans.1d.dp.o Ckmeans.1d.dp_main.o dynamic_prog.o fill_SMAWK.o fill_log_linear.o fill_quadratic.o select_levels.o weighted_select_levels.o -L/usr/lib64/R/lib -lR
/bin/sh: line 2: -shared: command not found
make: *** [Ckmeans.1d.dp.so] Error 127
ERROR: compilation failed for package ‘Ckmeans.1d.dp’
I am currently stuck with a server that only has R 3.1.1 and I do not have admin privileges. The $Rhome/etc/Makeconf has CXX and CC defined. I have also verified g++ and gcc are installed.
What could be happening here?
Invariably an environment variable with an 'empty' value gets expanded. Maybe (just guessing here) the package would use C++11, so $(CXX11} -shared gets expanded and ... becomes -shared and an error is triggered.
Look at the R settings, eg via less $(R HOME)/etc/Makevars and see what it expects.
I think you can get by, if you must, installing gcc et al below, say, ~/bin. Some packages will require a compiler...

R package DESCRIPTION - Remotes from Bioconductor should install binary

I am working on an R package (https://github.com/bgbrink/dropClust) and I was testing if it can be installed, since it depends on a number of packages both from CRAN and from Bioconductor. I specified the three dependencies from Bioconductor in the DESCRIPTION:
Remotes:
bioc::flowDensity,
bioc::SamSPECTRAL,
bioc::flowPeaks
However, when I try to install the package, the installation of flowPeaks fails, because the script downloades the source version of the package, which requires GSL to be present in order to be compiled.
* installing *source* package ‘flowPeaks’ ...
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include `gsl-config --cflags` -fPIC -Wall -g -O2 -c Rpack.cpp -o Rpack.o
/bin/sh: gsl-config: command not found
In file included from Rpack.cpp:16:
./gvector_gmatrix.h:24:10: fatal error: 'gsl/gsl_math.h' file not found
#include <gsl/gsl_math.h>
^
1 error generated.
make: *** [Rpack.o] Error 1
ERROR: compilation failed for package ‘flowPeaks’
When I download the package manually from Bioconductor, everything works fine, because the script downloades the binary version of the package. Can I specify somewhere that this is the default behaviour? I tried options(pkgType = "binary") without success.
Edit: No new ideas, so I'm bumping it once.

Install ROracle in Mac

I'm on Mac OS Sierra.
I have tried doing - Installation of RODBC/ROracle packages on OS X Mavericks but it didn't help.
This is what I did:
Downloaded from http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html - Basic, Sql plus, odbc
Unzipped in my home folder in instantclient_12_1
ln -s libclntsh.dylib.12.1 libclntsh.dylib
export DYLD_LIBRARY_PATH=/Users/dhananjaygoel/instantclient_12_1:$DYLD_LIBRARY_PATH
R CMD INSTALL --configure-args='--with-oci-lib=/Users/dhananjaygoel/instantclient_12_1' ROracle_1.3-1.tar.gz
It gives me the following error:
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library’
* installing *source* package ‘ROracle’ ...
** package ‘ROracle’ successfully unpacked and MD5 sums checked
configure: creating ./config.status
config.status: creating src/Makevars
** libs
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/Users/dhananjaygoel/instantclient_12_1/sdk/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -fPIC -Wall -mtune=core2 -g -O2 -I/opt/local/include -c rodbi.c -o rodbi.o
rodbi.c:2432:53: warning: format specifies type 'long long' but the argument has
type 'sb8' (aka 'long') [-Wformat]
sprintf(err_buf, RODBI_ERR_BIND_VAL_TOOBIG, bndsz);
^~~~~
/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
^~~~~~~~~~~
rodbi.c:2469:53: warning: format specifies type 'long long' but the argument has
type 'sb8' (aka 'long') [-Wformat]
sprintf(err_buf, RODBI_ERR_BIND_VAL_TOOBIG, bndsz);
^~~~~
/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
^~~~~~~~~~~
rodbi.c:2816:55: warning: format specifies type 'long long' but the argument has
type 'sb8' (aka 'long') [-Wformat]
sprintf(err_buf, RODBI_ERR_BIND_VAL_TOOBIG, bndsz);
^~~~~
/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
^~~~~~~~~~~
rodbi.c:2861:55: warning: format specifies type 'long long' but the argument has
type 'sb8' (aka 'long') [-Wformat]
sprintf(err_buf, RODBI_ERR_BIND_VAL_TOOBIG, bndsz);
^~~~~
/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
__builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
^~~~~~~~~~~
4 warnings generated.
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/Users/dhananjaygoel/instantclient_12_1/sdk/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -fPIC -Wall -mtune=core2 -g -O2 -I/opt/local/include -c rooci.c -o rooci.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o ROracle.so rodbi.o rooci.o -L/Users/dhananjaygoel/instantclient_12_1 -lclntsh -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.3/Resources/library/ROracle/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.3/Resources/library/ROracle/libs/ROracle.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.3/Resources/library/ROracle/libs/ROracle.so, 6): Library not loaded: #rpath/libclntsh.dylib.12.1
Referenced from: /Library/Frameworks/R.framework/Versions/3.3/Resources/library/ROracle/libs/ROracle.so
Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/ROracle’
Someone please help.
The following has worked for me on a few machines running El Capitan, so perhaps it will work on High Sierra. Unlike some other instructions, this does not require you to disable SIP.
Install the Oracle Instant Client Basic, SDK, and SQL*Plus packages. I'm pretty sure I'm not using the ODBC package, though it shouldn't get in the way if you do have it.
Create or edit ~/.R/Makevars. Add the following:
CC=/usr/bin/clang -rpath /Users/dhananjaygoel/instantclient_12_1
LDFLAGS=-L/Users/dhananjaygoel/instantclient_12_1
Both the -rpath setting in CC and the -L linked directory in LDFLAGS should be the location of the Instant Client's .dylib files. If you've moved them to another location (I personally prefer to make a /lib subdirectory and put them there), that's where you should point.
Run the install command:
R CMD INSTALL --configure-args='--with-oci-lib=/Users/dhananjaygoel/instantclient_12_1' ROracle_1.3-1.tar.gz
with --with-oci-lib= pointing to the root of the Instant Client (unlike the references in Makevars, this does not, as far as I know, rely on the location of the .dylib files).
I found this googling around.
Just Ctrl+f (or your alternative on Mac, I'm using linux) the word "image not found" and it'll take you to the problem.
The page will lead you eventually to here.
It's very similar to your error, however, I don't have any experience in using Mac, hope it helps though :)

Package Passes R CMD check in Linux, Windows Binary Fails

I submitted version 0.1-8 of a robust package I created to CRAN. R CMD Check passed on my computer runnning 64 bit Ubuntu and Rstudio. The Linux and Mac binaries are passing on CRAN. The windows binaries are failing on CRAN. The only difference between version 0.1-7 and 0.1-8 is I changed the namespace to adhere to the new version of R and I improved the documentation. None of the code has been changed.
https://cran.r-project.org/web/packages/robustreg/index.html
https://cran.r-project.org/web/checks/check_results_robustreg.html
Can anyone help me with the below error message?
* using log directory 'd:/Rcompile/CRANpkg/local/3.2/robustreg.Rcheck'
* using R version 3.2.1 (2015-06-18)
* using platform: x86_64-w64-mingw32 (64-bit)
* using session charset: ISO8859-1
* checking for file 'robustreg/DESCRIPTION' ... OK
* this is package 'robustreg' version '0.1-8'
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking whether package 'robustreg' can be installed ... ERROR
Installation failed.
See 'd:/Rcompile/CRANpkg/local/3.2/robustreg.Rcheck/00install.out' for details.
* DONE
The installation logfile:
* installing *source* package 'robustreg' ...
** package 'robustreg' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
make[1]: Entering directory `/cygdrive/d/temp/RtmpI9QsDz/R.INSTALL4b704d36335d/robustreg/src-i386'
g++ -I"D:/RCompile/recent/R-3.2.1/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/RCompile/CRANpkg/lib/3.2/RcppArmadillo/include" -I"d:/RCompile/r-compiling/local/local320/include" -O3 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
g++ -I"D:/RCompile/recent/R-3.2.1/include" -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/RCompile/CRANpkg/lib/3.2/RcppArmadillo/include" -I"d:/RCompile/r-compiling/local/local320/include" -O3 -Wall -mtune=core2 -c fit.cpp -o fit.o
g++ -shared -s -static-libgcc -o robustreg.dll tmp.def RcppExports.o fit.o -Ld:/RCompile/r-compiling/local/local320/lib/i386 -Ld:/RCompile/r-compiling/local/local320/lib -LD:/RCompile/recent/R-3.2.1/bin/i386 -lR
fit.o:fit.cpp:(.text$_ZN4arma27glue_times_redirect2_helperILb0EE5applyINS_3MatIdEENS_3ColIdEEEEvRNS3_INT_9elem_typeEEERKNS_4GlueIS7_T0_NS_10glue_timesEEE[void arma::glue_times_redirect2_helper<false>::apply<arma::Mat<double>, arma::Col<double> >(arma::Mat<arma::Mat<double>::elem_type>&, arma::Glue<arma::Mat<double>, arma::Col<double>, arma::glue_times> const&)]+0x262): undefined reference to `dgemv_'
fit.o:fit.cpp:(.text$_ZN4arma27glue_times_redirect2_helperILb0EE5applyINS_3MatIdEENS_3ColIdEEEEvRNS3_INT_9elem_typeEEERKNS_4GlueIS7_T0_NS_10glue_timesEEE[void arma::glue_times_redirect2_helper<false>::apply<arma::Mat<double>, arma::Col<double> >(arma::Mat<arma::Mat<double>::elem_type>&, arma::Glue<arma::Mat<double>, arma::Col<double>, arma::glue_times> const&)]+0x4a2): undefined reference to `dgemv_'
fit.o:fit.cpp:(.text$_ZN4arma27glue_times_redirect2_helperILb0EE5applyINS_3MatIdEENS_3ColIdEEEEvRNS3_INT_9elem_typeEEERKNS_4GlueIS7_T0_NS_10glue_timesEEE[void arma::glue_times_redirect2_helper<false>::apply<arma::Mat<double>, arma::Col<double> >(arma::Mat<arma::Mat<double>::elem_type>&, arma::Glue<arma::Mat<double>, arma::Col<double>, arma::glue_times> const&)]+0xb4c): undefined reference to `dgemv_'
collect2: ld returned 1 exit status
make[1]: Leaving directory `/cygdrive/d/temp/RtmpI9QsDz/R.INSTALL4b704d36335d/robustreg/src-i386'
make[1]: Entering directory `/cygdrive/d/temp/RtmpI9QsDz/R.INSTALL4b704d36335d/robustreg/src-i386'
make[1]: Leaving directory `/cygdrive/d/temp/RtmpI9QsDz/R.INSTALL4b704d36335d/robustreg/src-i386'
no DLL was created
ERROR: compilation failed for package 'robustreg'
* removing 'd:/Rcompile/CRANpkg/lib/3.2/robustreg'
* restoring previous 'd:/Rcompile/CRANpkg/lib/3.2/robustreg'
According to its automatically-created GitHub mirror and the src/ directory there in, you do not have a file src/Makevars.win. And you now have a linking error with LAPACK routines.
Simply add a file such as this one added when you use RcppArmadillo.package.skeleton() containing just
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
and you should be all set:
I am surprised this worked previously. You mostly got lucky--our documentation clearly says you need it.

Installing R packages

When I have tried to install some R packages such as Rgraphviz, I get the following error:
install.packages("Rgraphviz_2.12.0.tar.gz",repos=NULL,type="source")
* installing *source* package 'Rgraphviz' ...
**********************************************
WARNING: this package has a configure script
It probably needs manual configuration
**********************************************
** libs
gcc -m32 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG -
I"d:/RCompile/CRANpkg/extralibs64/local/include" -
Ilibwin/i386/include/graphviz -DHAVE_STDBOOL_H=1 -DHAVE_BOOL=1 -
DGRAPHVIZ_MAJOR=2 -DGRAPHVIZ_MINOR=28 -DGRAPHVIZ_STATIC -O3 -Wall -
std=gnu99 -mtune=core2 -c LL_funcs.c -o LL_funcs.o
gcc: unrecognized option `-std=gnu99'
d:\RCompile\CRANpkg\extralibs64\local\include\.: Permission denied
make.exe: *** [LL_funcs.o] Error 1
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-
31~1.2/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-31~1.2/share/make/winshlib.mk"
SHLIB="Rgraphviz.dll" OBJECTS="LL_funcs.o Rgraphviz.o RgraphvizInit.o
agopen.o agread.o agwrite.o bezier.o buildEdgeList.o buildNodeList.o
doLayout.o graphvizVersion.o init.o"' had status 2
ERROR: compilation failed for package 'Rgraphviz'
* removing 'C:/Program Files/R/R-3.1.2/library/Rgraphviz'
Warning messages:
1: running command '"C:/PROGRA~1/R/R-31~1.2/bin/i386/R" CMD INSTALL -l
"C:\Program Files\R\R-3.1.2\library" "Rgraphviz_2.12.0.tar.gz"' had status 1
2: In install.packages("Rgraphviz_2.12.0.tar.gz", repos = NULL, type =
"source") :
installation of package ‘Rgraphviz_2.12.0.tar.gz’ had non-zero exit status
I am mostly appreciate any comment.
The first thing to do is take care of the
d:\RCompile\CRANpkg\extralibs64\local\include\.: Permission denied
error. Check file permissions on that directory; does it belong to Administrator? Make sure you have read access to it.

Resources