Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install ROracle package on Windows 7?

Tags:

I'm trying to install ROracle package on my Windows 7 client. I have Oracle Instant client and Rtools installed, DBI package is istalled, OCI32_LIB environmental variable has been set. But when I try to install from command line:

C:\Temp>R CMD INSTALL --build ROracle_1.1-10.tar.gz * installing to library 'C:/Users/myaccount/Documents/R/win-library/3.0' * installing *source* package 'ROracle' ... ** package 'ROracle' successfully unpacked and MD5 sums checked ERROR: configuration failed for package 'ROracle' * removing 'C:/Users/myaccount/Documents/R/win-library/3.0/ROracle'  C:\Temp> 

When I try to install from source:

> install.packages("ROracle",type = "source") Warning in install.packages :   package ‘ROracle’ is not available (for R version 3.0.0) Installing package into ‘C:/Users/myaccount/Documents/R/win-library/3.0’ (as ‘lib’ is unspecified) trying URL 'http://cran.at.r-project.org/src/contrib/ROracle_1.1-10.tar.gz' Content type 'application/x-gzip' length 168193 bytes (164 Kb) opened URL downloaded 164 Kb  * installing *source* package 'ROracle' ... ** package 'ROracle' successfully unpacked and MD5 sums checked ERROR: configuration failed for package 'ROracle' * removing 'C:/Users/myaccount/Documents/R/win-library/3.0/ROracle' Warning in install.packages :   running command '"C:/PROGRA~1/R/R-30~1.0/bin/i386/R" CMD INSTALL -l "C:\Users\myaccount\Documents\R\win-library\3.0" C:\Users\myaccount\AppData\Local\Temp\RtmpGggbyp/downloaded_packages/ROracle_1.1-10.tar.gz' had status 1 Warning in install.packages :   installation of package ‘ROracle’ had non-zero exit status  The downloaded source packages are in     ‘C:\Users\myaccount\AppData\Local\Temp\RtmpGggbyp\downloaded_packages’ 

What should I do, how to proceed?

like image 203
Matkrupp Avatar asked Aug 04 '13 18:08

Matkrupp


2 Answers

From http://jgilfillan.github.io/2016/05/28/how-to-install-roracle-in-windows-7/

Download binary from oracle: http://www.oracle.com/technetwork/database/database-technologies/r/roracle/downloads/index.html

The run the following command in r, substituting the file path:

setwd('xxxxx')   # set to path of download install.packages('ROracle_1.2-1.zip', repos = NULL) 

Then load the library and use the package - you may have to change XXXX to whatever is in your TNS Names:

library('ROracle') drv <- dbDriver("Oracle") con <- dbConnect(drv, "USER GOES HERE", "PASSWORD GOES HERE", dbname='XXX') 

test connection:

dbReadTable(con, 'DUAL') 

Note that this has also been confirmed to work on Windows 10.

like image 187
Josh Gilfillan Avatar answered Sep 23 '22 19:09

Josh Gilfillan


I had this exact problem as well, including the OCI_INC error. They actually talk about it in the INSTALL file in the .tar.gz package, you can read more there.

You have to set the OCI_INC variable to the include directory like this:

set OCI_INC=C:\oracle\product\11.2.0\client_2\oci\include 

Or whereever your file is. Here was my complete setup to get things installed from an Admin privileged command line.

set OCI_LIB64=C:\oracle\product\11.2.0\client_2\BIN set OCI_INC=C:\oracle\product\11.2.0\client_2\oci\include set PATH=C:\oracle\product\11.2.0\client_2\BIN;C:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;%PATH% "C:/PROGRA~1/R/R-30~1.1/bin/x64/R" CMD INSTALL --build "C:/Your/Path/To/ROracle_1.1-10.tar.gz" 

Also, make sure to change client_2 to client_1 and OCI_LIB64 to OCI_LIB32 if you are trying to do a 32-bit install.

like image 33
nograpes Avatar answered Sep 21 '22 19:09

nograpes