ROracle - fails to install as "not built for UCRT"

3.1k views Asked by At

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".

3

There are 3 answers

4
Dirk is no longer here On

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.

0
Brian Syzdek On

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.

0
TobyT On

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.