RGDAL installation error: libnetcdf.so.6: cannot open shared object file: No such file or directory - r

I run RStudio Server on ubuntu 14.04. When trying to install the rgdal package I get the following error message:
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/admin2/R/x86_64-pc-linux-gnu- library/2.14/rgdal/libs/rgdal.so':
libnetcdf.so.6: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
I upgraded RStudio Server, R-Core and all Ubuntu packages to their latest versions but no success. I also tried apt-get install lib32stdc++6 as suggested here, but also no changes. I think it is a problem specific to GDAL and the indexing of shared libraries in unix. Can anyone help please?

Ok I got it done removing Gdal completly, compiling it from source again and setting library paths correctly as described here. Later adding /usr/local/lib/ to /etc/ld.so.conf and run sudo ldconfig as described here.

Related

R studio cannot find existing library

It seems that R studio cannot find a library (DirichletMultinomial.so)
I installed this library through R in command line. I had problem installing it with Rstudio, because this package requires gsl, which I compiled on my own (don't have sudo priviledge). I added the path of gsl libs to my $PATH and R command line was able to use it to install the packages. But Rstudio somehow still reports "gsl-config: command not found". It seems that Rstudio ignore my set up of $PATH completely and I have no idea how to fix it.
> library(TFBSTools)
Error: package or namespace load failed for ‘TFBSTools’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/bar/cfan/R/x86_64-pc-linux-gnu-library/3.5/DirichletMultinomial/libs/DirichletMultinomial.so':
libgsl.so.23: cannot open shared object file: No such file or directory
cfan#paleAle:~$ wc -l /bar/cfan/R/x86_64-pc-linux-gnu-library/3.5/DirichletMultinomial/libs/DirichletMultinomial.so
273 /bar/cfan/R/x86_64-pc-linux-gnu-library/3.5/DirichletMultinomial/libs/DirichletMultinomial.so

R: install uroot package in ubuntu

I am trying to install the forecast package which depends on uroot, which apparently have been written to require a GPU?
install.packages("uroot") yields the following error. Has anyone found this issue and may suggest a work around? I am using ubuntu 16.04.
I have the file in question located here: /usr/local/cuda-8.0/ and I added to my path export PATH=/usr/local/cuda-8.0/:$PATH
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/rstudio2/R/x86_64-pc-linux-gnu-library/3.2/uroot/libs/uroot.so':
libcudart.so.8.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/rstudio2/R/x86_64-pc-linux-gnu-library/3.2/uroot’
Warning in install.packages :
installation of package ‘uroot’ had non-zero exit status
Just in case this is useful for someone, I stumbled with the same problem trying to install "imputeTS" with R version 3.5.1 on Fedora 27 with CUDA 10.0 correctly installed an setted in PATH.
for me it just happened that I was running install.package("imputeTS") (which depends on forecast) in a R console as root, installing the packages to the user home solved the problem. It's seems that the libraries are searched in different places according to the user running the script, it's important to note that.
I just migrated to Linux. On an Ubuntu 18.04 setup, using install.packages with dependencies set to TRUE succeeded with no complaints. (No GPU on mu box.)
install.packages("forecast", dep=TRUE)
# there are quite a few dependencies and you happened to be missing one
packageDescription()
#-----------includes this line----------
Imports: colorspace, fracdiff, ggplot2 (>= 2.2.1), graphics, lmtest,
magrittr, nnet, parallel, Rcpp (>= 0.11.0), stats,
timeDate, tseries, urca, uroot, zoo
You can try to modify file "/etc/rstudio/rserver.conf", add "LD_LIBRARY_PATH" env, like:
rsession-ld-library-path=/usr/local/cuda/lib64
Actually, When you open session of "RStudio Server" from browser, the session does't get env from the ".bashrc".

ROracle not loading Instantclient library on MacOS High Sierra

I have installed Oracle Instant Client 12.1.0.2.0 and am now trying to install ROracle 1.3-1 for R with the following command:
R CMD INSTALL --configure-args='--with-oci-lib=/usr/local/oracle/instantclient12 --with-oci-inc=/usr/local/oracle/instantclient12/sdk/include' ROracle_1.3-1.tar.gz
The Oracle Instant Client is installed in /usr/local/oracle/instantclient12
Unfortunately, I am getting the following error at the end of the ROracle install and have been having a difficult time figuring out what is going wrong:
** 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 '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/ROracle/libs/ROracle.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/ROracle/libs/ROracle.so, 6): Library not loaded: #rpath/libclntsh.dylib.12.1
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/ROracle/libs/ROracle.so
Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/ROracle’
For whatever reason #rpath/libclntsh.dylib.12.1 can't be found and is preventing ROracle from being fully installed. I have tried putting a link to libclntsh.dylib.12.1 in ~/lib and /usr/lib but neither link worked. I have also tried pointing to the directory containing libclntsh.dylib.12.1 with the environment variables DYLD_FALLBACK_LIBRARY_PATH and DYLD_LIBRARY_PATH but those have not worked as well.
I am using MacOS High Sierra (10.13) and R 3.4.2.
The only way I have found so far to get around this problem is to put a link to libclntsh.dylib.12.1 in the framework lib directory for R. On my computer the R framework lib directory is located in /Library/Frameworks/R.framework/Resources/lib
My instant client is installed in /usr/local/oracle/instantclient12
So I use the following command to make the file link:
ln -s /usr/local/oracle/instantclient12/libclntsh.dylib.12.1 /Library/Frameworks/R.framework/Resources/lib/libclntsh.dylib.12.1
This resolves the ROracle install problem and I can now load the ROracle library in R without issue.

Error while installing "nloptr_1.0.4.tar.gz" from local

When i tried to install nloptr_1.0.4.tar.gz from local, It needed another unix library nlopt-2.4.2.tar.gz which I got it resolved from the following thread Error while installing a tar.gz package in R
But, even after that the package is not getting installed
It throws the following error,
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/cloudera/R/x86_64-redhat-linux-gnu-library/3.2/nloptr/libs/nloptr.so':
/home/cloudera/R/x86_64-redhat-linux-gnu-library/3.2/nloptr/libs/nloptr.so: undefined symbol: nlopt_set_maxtime
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/cloudera/R/x86_64-redhat-linux-gnu-library/3.2/nloptr’
For the above error, I got a lead from the following link:https://cran.r-project.org/web/packages/ROracle/INSTALL
and http://ab-initio.mit.edu/wiki/index.php/NLopt_Installation
Based on the above links, I had to set LD_LIBRARY_PATH variable to /usr/local/lib and /usr/local/include
Even after setting the above Environment variable, R CMD INSTALL nloptr_1.0.4.tar.gz is not getting installed and throwing the same error.
The fix is easy. On a Debian/Ubuntu system do
sudo apt-get install libnlopt-dev
as you always need the development package to compile a given library. It will then be found, and nloptr will install without a hitch.
Similarly on a RH/FC/CentOS with rpms.
Now, when I helped Jelmer rewrite the configuration for nloptr, we did make sure it worked both ways: with an install nlopt library, and without. You seem to stuck in the middle with one that is installed, but different ("missing symbol"). If you cannot uninstall that 'wrong' libnlopt, I would recommend altering the nloptr sources to not check for it but rather always build itself against a copy of nlopt 2.4.2 which it will download and compile statically.

RPostgreSQL installation Error - RPostgreSQL.so: undefined symbol: PQpass

I am trying to install R-Package RPostgreSQL, but getting the following error,
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/lib64/R/library/RPostgreSQL/libs/RPostgreSQL.so':
/usr/lib64/R/library/RPostgreSQL/libs/RPostgreSQL.so: undefined symbol: PQpass
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/lib64/R/library/RPostgreSQL’
I have libpq and postgresql-dev installed. All the library files are in the directory
/usr/lib64/pgsql/ and all header files are in the directory
/usr/include/pgsql/
Postgre Version - 9.3.4
R Version - 3.0.2
Operating System - CentOS-6.4
I am missing some small thing, but unable to find out why this is happening.
What am I doing wrong? How to correct this?
Looks like the pgsql libraries are no longer installed in their previous locations. I linked both:
ln -s /usr/pgsql-9.3/lib /usr/lib/pgsql
ln -s /usr/pgsql-9.3/include /usr/include/pgsql
This worked for me :)
The package RPostgreSQL checks for PostgreSQL libraries only in the following directory paths,
/usr/lib
/usr/lib/pgsql
/usr/lib/postgresql
/usr/local/lib
/usr/local/lib/pgsql
/usr/local/lib/postgresql
/usr/local/pgsql/lib
/usr/local/postgresql/lib
/opt/lib
/opt/lib/pgsql
/opt/lib/postgresql
/opt/local/lib
/opt/local/lib/postgresql
/opt/local/lib/postgresql84
/sw/opt/postgresql-8.4/lib
/Library/PostgresPlus/8.4SS/lib
/sw/lib
It does not check for the directories either in LD_LIBRARY_PATH or in /etc/ld.so.conf.
So RPostgreSQL installation will be successful only if the PostgreSQL libraries exist in any of the above directories.
When I copied the libraries from /usr/lib64/pgsql to /usr/lib/pgsql and tried installing the package. It worked. :)

Resources