1

So I have followed these instructions here:

https://medium.com/analytics-vidhya/how-to-install-roracle-on-windows-10-144b0b923dac

Effectively install the thin client, set environment variables...then download ROracle 64 bit for windows and run the following in R:

setwd("C:/Users/MyName/Downloads")
install.packages("ROracle_1.3-2.zip",repos = NULL)
install.packages("DBI")
library("DBI")
library("ROracle")

And I am getting this error:

source("~/.active-rstudio-document")
Installing package into ‘C:/Users/MyName/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
package ‘ROracle’ successfully unpacked and MD5 sums checked
Error in install.packages : package ‘ROracle’ not installed because it is not built for UCRT
Installing package into ‘C:/Users/MyName/AppData/Local/R/win-library/4.2’

R is certainly proving more tricky than Python. This is solved with "pip install cx_Oracle".

smackenzie
  • 2,880
  • 7
  • 46
  • 99

3 Answers3

2

It was PAINFUL, but I was able to install ROracle, building from source, in RStudio R4.2 with Windows 11. Here are my notes:

###*** PROCEDURE TO INSTALL ROracle ***###

Notes from https://community.oracle.com/tech/developers/discussion/4493466/roracle-for-r-4-0-0-or-newer

  1. Get and install the new version of R.

  2. Install the new version of Rtools. In my case it was the version 4.2 like stated in post at notes page above: https://cran.r-project.org/bin/windows/Rtools/rtools42/rtools.html. Click Rtools42_installer. Accept defaults.

  3. Get new version of Oracle Instant Client and extract it into folder C:\oracle, creating C:\oracle\instantclient_21_6 https://www.oracle.com/database/technologies/instant-client/downloads.html

  4. Get new version from sdk package for the Instant client https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html Make sure to extract sdk package into instant client folder at: C:\oracle\instantclient_21_6. So in my case resulting in: C:\oracle\instantclient_21_6\sdk.

  5. Open your "Environment Variables" and add variable "OCI_LIB64" with same value where your Instant client is located (in my case C:\oracle\instantclient_21_6)

In "Environment Variables" also add variable "PATH" with same value C:\oracle\instantclient_21_6 (There was already a "Path" variable. Add "PATH" as new. I got LoadLibrary errors until doing this.

  1. Download new version of ROracle (ROracle_1.3-2.tar.gz) https://www.oracle.com/database/technologies/roracle-downloads.html and store it into document folder. At least in my case remotes::install_local function called the package from that location. When you try to run the install command in R the remotes::install_local will give you warning where it is trying to find ROracle if it cannot find it.

  2. Open R (if already running, need to restart for environment variable changes to take effect)

Set wd to Documents: setwd("~/")

install.packages("codetools") # is this part of base R? might not need additional installation??

install.packages("remotes")

remotes::install_local("ROracle_1.3-2.tar.gz", repos = NULL, type = "source")

Hopefully, this all works. You will need package "DBI" as well.

Brian Syzdek
  • 873
  • 6
  • 10
1

As you can see at the CRAN package page for ROracle are no pre-made binaries available: not for Windows, not for macOS, not for macOS-Arm64.

You attempted to install an different version, and the error message tells you in clear terms that is not suitable for the current R version on Windows which has switched (as of R 4.2.0 in April) to UCRT builds in order to support utf-8 better on Windows. (There has been ample documentation on the underlying details at the R developer blog.)

The version you have seems to have been built for the previous version so if you need it badly, maybe downgrading to R 4.1.* is an option for you. Otherwise maybe you can get the good folks behind the database system you want to use to build you an updated version for the current R, or maybe attempt to do it yourself.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • The CRAN page is not the best resource for ROracle, since the CRAN tooling refuses to allow new ROracle packages to be uploaded. The current source and prebuilt binaries are available from Oracle at https://www.oracle.com/database/technologies/roracle-downloads.html – Christopher Jones Aug 15 '22 at 06:43
  • 1
    Might be beneficial to replace the CRAN package with a transition package pointing at this resource -- CRAN is and will remain the place many go first for intormation. – Dirk Eddelbuettel Aug 15 '22 at 11:59
  • The error message is "...‘ROracle’ not installed because it is not built for UCRT". Given that a normal person will not know what UCRT means, it is not fair to say that the "error message tells you in clear terms that is not suitable for the current R version on Windows". – gruvn Feb 23 '23 at 17:16
  • You are barking up the wrong tree, please discuss with R Core whether using UCRT is or is not a useful moniker. Per Google, the term is used 3470 times within 'site:r-project.org'. Asking Google 'what is UCRT' has [this SO answer](https://stackoverflow.com/questions/67848972/differences-between-msvcrt-ucrt-and-vcruntime-libraries) as the second hit. – Dirk Eddelbuettel Feb 23 '23 at 18:02
1

The answer from @Brian-Syzdek helped me install on a Windows 10 Device. A couple of additional points that may assist others.

  • I didn't need to install the codetools package.
  • Make sure you download and install the ROracle_1.3-2.tar.gz file at the top of the table at https://www.oracle.com/database/technologies/roracle-downloads.html , not the zip file which is linked next to the Windows row.
  • I had to use remotes:install_local in the RStudio console; using the Rstudio menu Tools->Install Packages... didn't work for me, although this may be linked to trying to install the zip file originally, not the tar.gz.
TobyT
  • 73
  • 6