Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

rstudio - ROracle not working in R studio

I'm trying to install ROracle package on a unix box. The package gets installed properly. But library(ROracle) does not work fine with the error

library(ROracle)
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
unable to load shared object '/u01/group1/home/oracle/R/x86_64-redhat-linux-gnu-library/3.1/ROracle/libs/ROracle.so':
libclntsh.so.11.1: cannot open shared object file: No such file or directory
Error: package or namespace load failed for ‘ROracle’

The package installs fine from the command line , but just does not work in R studio. I went through lot of threads in forum and lot of them suggested to export the LD_LIBRARY_PATH and reset it.infact i went ahead and copied all the R system variables from command line into R Studio. But it still does not work out fine.

One thing i have also noticed is that the R system variables change every time i restart R studio. Can it be the problem that R studio is not taking path values correctly.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Seems that the problem is caused by the $LD_LIBRARY_PATH environment variable not being set in a way that is system-wide. Unlike other environment variables, $LD_LIBRARY_PATH needs special treatment (see the Ubuntu Help page and search for ld.so.conf.d)

I was able to solve this by setting the $LD_LIBRARY_PATH as per comment 15:

echo "/usr/lib/oracle/11.2/client64/lib" | sudo tee /etc/ld.so.conf.d/oracle.conf

Change the echo statement to where your Oracle Instant Client libraries are stored. (Mine could be found by running echo $OCI_LIB.

Then update the cache:

sudo ldconfig -v

Then open RStudio, execute library("ROracle") and it should work.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...