Installing ROracle (and the Oracle Instant Client?) on MacOS - r

I'm trying to install ROracle. Since ROracle requires the Oracle OCI libraries, I downloaded these files from the Oracle website: instantclient-basic-macos.x64-12.2.0.1.0, instantclient-sdk-macos.x64-12.2.0.1.0.zip. I put those files in ~/Library/Caches/Homebrew and install them using homebrew.
brew install instantclient-basic
brew install instantclient-sdk
The Oracle website also mentioned the need to set some environment variables, so I put this in my .bashrc file:
export LD_LIBRARY_PATH=/usr/local/Cellar/instantclient-basiclite/12.2.0.1.0/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=/usr/local/Cellar/instantclient-basiclite/12.2.0.1.0/lib:$DYLD_LIBRARY_PATH
export NLS_LANG=UTF8
But trying to install ROracle in R leads to this:
> install.packages("ROracle")
Installing package into ‘/usr/local/lib/R/3.4/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/ROracle_1.3-1.tar.gz'
Content type 'application/x-gzip' length 308252 bytes (301 KB)
==================================================
downloaded 301 KB
Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'zone/tz/2017c.1.0/zoneinfo/America/Los_Angeles'
* installing *source* package ‘ROracle’ ...
** package ‘ROracle’ successfully unpacked and MD5 sums checked
configure: error: OCI libraries not found
ERROR: configuration failed for package ‘ROracle’
* removing ‘/usr/local/lib/R/3.4/site-library/ROracle’
Warning in install.packages :
installation of package ‘ROracle’ had non-zero exit status
R says it can't find the OCI libraries. Oracle's documentation has so far proven non-existent or worthless in resolving this issue, but I found a comment on the internet that seemed promising. So I wrote this into my .bashrc and ran it:
R CMD INSTALL --configure-args='--with-oci-lib=/usr/local/Cellar/instantclient-basic/12.2.0.1.0/lib --with-oci-inc=/usr/local/Cellar/instantclient-sdk/12.2.0.1.0/lib/sdk/include' ROracle_1.3-1.tar.gz
With this result:
installing to /usr/local/lib/R/3.4/site-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: package or namespace load failed for ‘ROracle’ in dyn.load(file, DLLpath = DLLpath, ...):
****unable to load shared object '/usr/local/lib/R/3.4/site-
library/ROracle/libs/ROracle.so':
dlopen(/usr/local/lib/R/3.4/site-library/ROracle/libs/ROracle.so, 6): Symbol
not found: _ons_recvthread_clone_sb
Referenced from: /usr/local/Cellar/instantclient-basic/12.2.0.1.0/lib/libons.dylib
Expected in: flat namespace
in /usr/local/Cellar/instantclient-basic/12.2.0.1.0/lib/libons.dylib
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/3.4/site-library/ROracle’
So there's something wrong with libons.dylib? What am I supposed to do with that information?

The Instant Client 12.2 for macOS was patched. Get it from http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html and unzip it, for example into ~/instantclient_12_2
I was able to install ROracle on macOS with:
brew install R
Update rpath in the library (using the correct version number for R):
install_name_tool -add_rpath ~/instantclient_12_2 /usr/local/Cellar/r/3.4.3/lib/R/bin/exec/R
Run 'R' and then:
install.packages("DBI")
Download ROracle_1.3-1.tar.gz from https://cran.r-project.org/web/packages/ROracle/index.html and install it:
R CMD INSTALL --configure-args='--with-oci-lib=/Users/cjones/instantclient_12_2 --with-oci-inc=/Users/cjones/instantclient_12_2/sdk/include' ROracle_1.3-1.tar.gz

A solution for that without -add_rpath can be found on Intall ROracle Package for Windows and Mac OS
I use R from Macports and I did:
cd /opt/local/Library/Frameworks/R.framework/Resources/lib
sudo ln -s ~/Applications/instantclient/libclntsh.dylib.12.1
sudo ln -s ~/Applications/instantclient/libclntshcore.dylib.12.1
sudo ln -s libclntsh.dylib.12.1 libclntsh.dylib
sudo ln -s libclntshcore.dylib.12.1 libclntshcore.dylib
I think only the link to libclntsh.dylib.12.1' is needed. But it does not harm to create the others as well. This way you do not need to runinstall_name_tool` after every upgrade to R.
After creating the links I was able to install ROracle using R CMD INSTALL

Related

Unable to install package RGLPK with R Studio Server in AWS

I am trying to install the package RGLPK with an AWS EC2 instance which has R Studio 1.3 and R 4.0 running. I get this result:
> install.packages("Rglpk")
Installing package into ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/Rglpk_0.6-4.tar.gz'
Content type 'application/x-gzip' length 21753 bytes (21 KB)
==================================================
downloaded 21 KB
* installing *source* package ‘Rglpk’ ...
** package ‘Rglpk’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
/bin/bash: line 0: cd: GLPK: No such file or directory
Makevars:10: recipe for target 'GLPK.ts' failed
make: *** [GLPK.ts] Error 1
ERROR: compilation failed for package ‘Rglpk’
* removing ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/4.0/Rglpk’
Warning in install.packages :
installation of package ‘Rglpk’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpHmQk09/downloaded_packages’
I have found numerous similar errors involving this package. Such as this:
GLPK: No such file or directory error when trying to install R package
There seems to be 3 or 4 solutions, but they involve sudo commands from the terminal window. I am in a virtual machine.
This worked:
In the terminal within R Studio Server:
sudo apt install libglpk-dev
And back in the console, install the R library:
install.packages("Rglpk")
Credit: #AdamErickson from this post:
GLPK: No such file or directory error when trying to install R package

Error when trying to install vcfR in Rstudio

I'm having trouble installing the vcfR package in R studio.
I'm on Ubuntu 18.04.4 LTS in Rstudio and my R version 3.6.3
When I try to install using:
install.packages('vcfR')
I get a non-zero exit status
Installing package into ‘/home/username/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'http://cran.r-project.org/src/contrib/vcfR_1.11.0.tar.gz'
Content type 'application/x-gzip' length 1453180 bytes (1.4 MB)
==================================================
downloaded 1.4 MB
* installing *source* package ‘vcfR’ ...
** package ‘vcfR’ successfully unpacked and MD5 sums checked
** using staged installation
./configure: 4: ./configure: checkbashisms: not found
Warning in system(cmd) : error in running command
ERROR: configuration failed for package ‘vcfR’
* removing ‘/home/username/x86_64-pc-linux-gnu-library/3.6/vcfR’
Warning in install.packages :
installation of package ‘vcfR’ had non-zero exit status
I'm not really sure where to go from here or what to try to fix it.
This would appear to be due to a simple bug in the package vcfR. In the most recent version its configure script consists of
#!/bin/sh
#
checkbashisms --force
# EOF.
which makes little to no sense. CRAN never noticed because they now have the script checkbashishm (from Debian's devscript package) installed. Someone should tell the maintainer of vcfR to correct this. I'll send him a mail. At a minimum it should change to
if [ -f /usr/bin/checkbashisms ]; then
checkbashisms --force
fi
I found this on github, so apparently it is a general issue:
https://github.com/r-hub/rhub-linux-builders/issues/46
I'm also running Ubuntu 18.04.04, and got the same error message as you. I installed the devscripts package through the terminal using the following code:
sudo apt update
sudo apt install devscripts
I was then able to successfully install vcfR in RStudio.

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

while installing rpackage Roracle on windows 10 i'm getting stuck at this point
install.packages("ROracle")
Installing package into ‘C:/Users/admin/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
Package which is only available in source form, and may need compilation of C/C++/Fortran:
‘ROracle’
Do you want to attempt to install these from sources?
y/n: y
installing the source package ‘ROracle’
trying URL 'https://cran.rstudio.com/src/contrib/ROracle_1.3-1.tar.gz'
Content type 'application/x-gzip' length 308252 bytes (301 KB)
downloaded 301 KB
* installing *source* package 'ROracle' ...
** package 'ROracle' successfully unpacked and MD5 sums checked
ERROR: cannot find Oracle Client.
Please set OCI_LIB64 to specify its location.
Warning: running command 'sh ./configure.win' had status 1
ERROR: configuration failed for package 'ROracle'
* removing 'C:/Users/admin/Documents/R/win-library/3.3/ROracle'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-33~1.2/bin/x64/R" CMD INSTALL -l "C:\Users\admin\Documents\R\win-library\3.3" C:\Users\admin\AppData\Local\Temp\RtmpGYlz5L/downloaded_packages/ROracle_1.3-1.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\admin\AppData\Local\Temp\RtmpGYlz5L\downloaded_packages’
I've installed Rtools Rtools33.exe and my R version is version.string R version 3.3.2 (2016-10-31)
please help to connect it with oracle 11g database
Oracle client is intalled in d drive which path is:
D:\app\admin\product\11.2.0\client_1\BIN
As #Nathan Dobie mentionned, instructions on the ROracle installation were helpful for me. I didn't need Rtools.exe but i had to add oracle instant client in the Environment variables.
Configuration in 64bits:
Under System variables, create OCI_LIB64 if it does not already exist.
Set the value of OCI_LIB64 to D:\app\admin\product\11.2.0\client_1\BIN (in your case)
Under System variables, edit PATH to include
D:\app\admin\product\11.2.0\client_1\BIN
And you will also need to create OCI_INC with the following value
D:\app\admin\product\11.2.0\client_1\oci\include
Worked very well for me :-)

Rgdal package installation on Amazon Linux AMI

I've installed geos, proj-4.8.0 and gdal-1.9.2, yet, after installing the R package rgeos, rgdal fails to install.
Here is a look at my home directory:
. . . and the error I get running install.packages("rgdal", type="source"):
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/mainstorage/michaeld/R/x86_64-redhat-linux-gnu-library/3.1/rgdal/libs/rgdal.so':
libgdal.so.1: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/mainstorage/michaeld/R/x86_64-redhat-linux-gnu-library/3.1/rgdal’
The downloaded source packages are in
‘/tmp/Rtmpt51iFG/downloaded_packages’
Warning message:
In install.packages("rgdal", type = "source") :
installation of package ‘rgdal’ had non-zero exit status
I infer that this error has something to do with a dependent library. . . but that is all I gather.
I should mention that running sudo yum install libgdal1 libgdal1-dev libgeos libgeos-dev as suggested here yields the following:
No package libgdal1 available.
No package libgdal1-dev available.
Package geos-3.4.2-1.3.amzn1.x86_64 already installed and latest version
No package libgeos-dev available.
So, perhaps the better question is how do I install these dev packages?
Thanks for any direction.
You probably need to update the dynamic library cache, using ldconfig as superuser.
Alternatively, rather than building the packages from source, you can enable the Extra Packages for Enterprise Linux (EPEL) repository.

Using old packages that has not been updated on newer version of R

I have updated R and get problems when I want to run old scripts. Specifically, one of the packages I use has been removed from CRAN and I get the following error message when I try to load the installed package (installed from a binary file of the latest version of the package without any problem. As you can see, the package in question is the ACER package):
Failed with error: ‘package ‘acer’ was built before R 3.0.0: please re-install it’
Is it possible to recompile the source file to get binary files that work on R > 3.0.0?? This package worked fine on previous version R 3.0.1, but not on R 3.1.1. Is there any way I can get this package correctly loaded on R 3.1.1 (using either the source file or the file compiled for R 3.0.1?
I already tried to install from source, but it doesn't work. I get this error messages, which don't make too much sense to me. Is there an easy way out of this?
> install.packages(pkgs="acer_0.1.2.tar.gz", type="source", repos=NULL)
Installing package into ‘C:/Users/user/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
* installing *source* package 'acer' ...
** package 'acer' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-31~1.1/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-31~1.1/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="acer.dll" OBJECTS="estimate_acer.o peaks.o"' had status 127
ERROR: compilation failed for package 'acer'
* removing 'C:/Users/user/Documents/R/win-library/3.1/acer'
* restoring previous 'C:/Users/user/Documents/R/win-library/3.1/acer'
Warning messages:
1: running command '"C:/PROGRA~1/R/R-31~1.1/bin/x64/R" CMD INSTALL -l "C:\Users\user\Documents\R\win-library\3.1" "acer_0.1.2.tar.gz"' had status 1
2: In install.packages(pkgs = "acer_0.1.2.tar.gz", type = "source", :
installation of package ‘acer_0.1.2.tar.gz’ had non-zero exit status
I also tried installing it from the command line but get similar errors. Can anyone help?
Do you have Rcpp installed and on your path?
I think error code 127 on make means that the program couldn't be found in your $PATH and the only dependency of acer seems to be Rcpp.
Hope this helps
-A

Resources