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

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.

Related

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

NLoptr failed to install on Mac: unable to load shared object

I'm trying to install the package nloptr on Mac OS High Sierra in order to use many nice packages like lme4, and I'm using RStudio inside Anaconda, with R 3.4.2. I have also installed NLopt (downloaded from the NLopt website, not the development version. I have also installed Xcode command line tool. But I still can't install nloptr, and get this
Error: package or namespace load failed for ‘nloptr’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/lambda/anaconda3/lib/R/library/nloptr/libs/nloptr.so':
dlopen(/Users/lambda/anaconda3/lib/R/library/nloptr/libs/nloptr.so, 6): Symbol not found: _nlopt_add_equality_mconstraint
Referenced from: /Users/lambda/anaconda3/lib/R/library/nloptr/libs/nloptr.so
Expected in: flat namespace
in /Users/lambda/anaconda3/lib/R/library/nloptr/libs/nloptr.so
I already searched online for what to do, and did add the path where NLopt was installed to LD_LIBRARY_PATH in the /etc/ldpaths file, but I still get the same error. Yes, I have the same problem as in Trouble installing nloptr package on R 3.3.0, but I didn't find a solution that works there since the person who asked that question resolved it himself and I don't know what he meant when he said "installed as a root". Can anyone help?
Also, I got something like this when installing NLopt with CMake, and this happened to many different functions:
In file included from f77api.c:103:
./f77funcs.h:57:14: warning: 'nlopt_minimize_constrained' is deprecated
[-Wdeprecated-declarations]
*info = nlopt_minimize_constrained((nlopt_algorithm) *algorithm,
^
./nlopt.h:348:35: note: 'nlopt_minimize_constrained' has been explicitly marked
deprecated here
int maxeval, double maxtime) NLOPT_DEPRECATED;
^
./nlopt.h:320:43: note: expanded from macro 'NLOPT_DEPRECATED'
# define NLOPT_DEPRECATED __attribute__((deprecated))
^
Would this be why the library isn't loaded?
BTW, I have installed Rcpp and updated it. Rcpp works on my computer.
Update: I changed the default C and C++ compiler to clang4 downloaded from R project. I tried the installation again, and got a different error:
Error: package or namespace load failed for ‘nloptr’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Users/lambda/anaconda3/lib/R/library/nloptr/libs/nloptr.so':
dlopen(/Users/lambda/anaconda3/lib/R/library/nloptr/libs/nloptr.so, 6): Library not loaded: #rpath/libnlopt.0.dylib
Referenced from: /Users/lambda/anaconda3/lib/R/library/nloptr/libs/nloptr.so
Reason: image not found
Error: loading failed
I have tried to tell R where the library is by Sys.geteng(DYLD_LIBRARY_PATH = "/usr/local/lib"), but it didn't work. It actually appears that R does know where the shared library is, according to the messages I got from installation, but it just can't load it. Please help!
Never mind, I reinstalled Anaconda, and installed the standalone R and RStudio (not within Anaconda), and those packages all installed successfully. Maybe it's a bad idea to use the RStudio inside Anaconda.
Edit: For those who run into similar scenarios: I switched to Microsoft R Open (MRO), since I'm dealing a lot with linear algebra recently. Then when I tried to install nloptr in MRO, I got a similar error message that shared library failed to load because image not found. I reinstalled the CRAN R 3.4.3 and nloptr installed totally fine there. So I found where nloptr was installed in CRAN R 3.4.3 by .libPaths(), copied the nloptr folder to where MRO stores packages, and used the utility RSwitch to change the default version of R to MRO. Then I loaded nloptr in MRO, installed packages that depend on it, and used those packages; they worked fine. I don't know what's wrong with MRO that caused the error, but at least this worked.

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.

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

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.

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