windowsroracle

ROracle install


I am having trouble getting the ROracle package to run on my computer. I have windows 10 and R 3.5.1 (it worked on windows 7). First Attempt:

install.packages("ROracle")
Installing package into 
‘C:/Users/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
Package which is only available in source form, and may need compilation of 
C/C++/Fortran: ‘ROracle’
These will not be installed

I followed the instructions here and downloaded it from Oracle directly How to install ROracle package on Windows 7?

I also looked at these sites, but the suggestions don’t work their either. How to install ROracle package?

ROracle installation :: Unable to load shared object error

how to install r package for oracle on windows 10 64 bit

setwd("C:\\Users\\Downloads")
install.packages('ROracle_1.3-1.zip', repos = NULL)
Installing package into ‘C:/Users/Documents/R/win-library/3.5’
   (as ‘lib’ is unspecified)
   package ‘ROracle’ successfully unpacked and MD5 sums checked

library(ROracle)
Error: package or namespace load failed for ‘ROracle’:
package ‘ROracle’ was installed by an R version with different internals; it 
needs to be reinstalled for use with this R version

I have mysql and sqldeveloper on my machine. Any help would be appreciated.


Solution

  • Download compatible versions of ROracle, Instant Client & R

    LATEST version of RTools can be downloaded from link below

    Important links: Instant Client Version (12.2): Download the basic as well sdk version of instant client http://www.oracle.com/technetwork/database/features/instant-client/

    R for Windows (Look for previous releases of R for Windows) https://cran.rstudio.com/bin/windows/base/old/ https://cran.rstudio.com/bin/windows/base/old/3.6.1/R-3.6.1-win.exe

    RTools (RTools35) https://cran.r-project.org/bin/windows/Rtools/

    ROracle (ROracle-1.3.2 is compatible with R3.6.0 version and above) https://www.oracle.com/database/technologies/roracle-downloads.html Very important link for Troubleshooting ROracle: https://cran.cnr.berkeley.edu/web/packages/ROracle/INSTALL

    RStudio

    Set the below environment variables in control Panel > System & Security > System> Advanced System Settings> In System properties, click on "Environment Variables"> In system variables SET BELOW:

    ORACLE_HOME = 'C:/oreclient_install_dir/instantclient_12_2'
    OCI_INC     = 'C:/oreclient_install_dir/instantclient_12_2/sdk/include'
    OCI_LIB64   = 'C:/oreclient_install_dir/instantclient_12_2'
    TNS_ADMIN   = 'C:/oreclient_install_dir/instantclient_12_2'
    

    Please see I have installed 64-bit version of R and hence setting environment variables for the same. If you are using 32-bit version, please set OCI_LIB32 with appropriate path. Also, place the TNS file at the appropriate location.

    Also, set path to include:

    C:\oreclient_install_dir\instantclient_12_2 <br/>
    C:\app\client\pc_username\product\12.2.0\client_1  
    C:\app\client\pc_username\product\12.2.0\client_1\bin  
    C:\app\client\pc_username\product\12.2.0\client_1\Network\Admin  
    %PATH%
    C:\R\R-3.6.0\bin  
    C:\R\Rtools\bin  
    C:\R\Rtools\mingw_64\bin  
    

    Few important R commands to check the variables set:

    R.home(component = "home")
    Sys.getenv("PATH")
    Sys.getenv("OCI_INC")
    Sys.getenv("OCI_LIB64")
    Sys.getenv("ORACLE_HOME")
    Sys.getenv("TNS_ADMIN")
    

    Please re-start R when the env variables are set and it is recommended to run R as administrator when running ROracle commands.

    install.packages("C:/ROracle/ROracle_1.3-2.tar.gz", repos = NULL)

    you may need to install DBI package as well

    install.packages("DBI")
    library("DBI")
    library("ROracle")