Cannot install rgdal package in R on RHEL6, unable to load shared object rgdal.so - r

I have AWS RHEL6 server where I've installed (compiled) rgdal 1.9.2 and proj packages. Now in R I want to install rgdal package but it gives this error:
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/Roel/R/x86_64-redhat-linux-gnu-library/3.3/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 ‘/home/Roel/R/x86_64-redhat-linux-gnu-library/3.3/rgdal’
Warning in install.packages :
installation of package ‘rgdal’ had non-zero exit status
Full install log can be found here.
When I do locate rgdal.so in Linux it doesn't find anything. I can also not find how to get rgdal.so of what it is part of.
Has anyone any idea on how to fix this?

I fixed it:
There is an error further up in the log as well that I had missed because of the error at the end:
./proj_conf_test: error while loading shared libraries: libgdal.so.1: cannot open shared object file: No such file or directory
libgdal.so.1 was on the system in /usr/local/lib.
I then did:
echo "/usr/local/lib" >> /etc/ld.so.conf.d/R-dependencies-x86_64.conf
ldconfig
This fixed the subsequent error that I mentioned in the OP.

If you see Permission Denied when running Roel's, try:
sudo ldconfig -c "echo '/usr/local/lib' >> /etc/ld.so.conf.d/R-dependencies-x86_64.conf"

Related

I am trying to install openssl package in R using Ubuntu 18.04 without success

I try to install the Openssl package in R (using RStudio in Ubuntu 18.04), but I get the error "undefined symbol: RSA_pkey_ctx_ctrl":
Error: package or namespace load failed for ‘openssl’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/danilo/R/x86_64-pc-linux-gnu-library/3.4/openssl/libs/openssl.so':
/home/danilo/R/x86_64-pc-linux-gnu-library/3.4/openssl/libs/openssl.so: undefined symbol: RSA_pkey_ctx_ctrl
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/danilo/R/x86_64-pc-linux-gnu-library/3.4/openssl’
Warning in install.packages :
installation of package ‘openssl’ had non-zero exit status.
I have already tried to install through both RStudio and Terminal, but as I am relatively new to Ubuntu, I did not have any success. I have the tar.gz file downloaded, but I don't know what should I do with it.
I actually want to use packages httr and ggmap, but they both require openssl.
Try in terminal:
sudo apt-get install libssl-dev
and after that try to install package openssl in R again.

Why does installed "igraph" package return "libicui18n.so.58: cannot open shared object file"after loading?

I was trying to install the package igraph in R using the command install.packages("igraph"). After the installation, during testing phase it showed the following error:
testing if installed package can be loaded Error: package or namespace
load failed for ‘igraph’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object
'/home/midhun/R/x86_64-redhat-linux-gnu-library/3.5/igraph/libs/igraph.so':
libicui18n.so.58: cannot open shared object file: No such file or
directory Error: loading failed Execution halted ERROR: loading
failed
removing ‘/home/midhun/R/x86_64-redhat-linux-gnu-library/3.5/igraph’
The downloaded source packages are in
‘/tmp/RtmpLVDism/downloaded_packages’ Warning message: In
install.packages("igraph") : installation of package ‘igraph’ had
non-zero exit status
Why this is happening? What could be a solution?
The library igraph requires library files such as:
libicui18n.so.58, libicuuc.so.58, libgfortran, etc.
These were either not installed in the proper library folder or were existing as previous versions. For example, in my case, libicuuc.so.58 was required to be installed in usr/lib64. Make sure that dependencies are installed correctly to solve such problems.

Error installing packages in R after messing with "pahts"

I was trying to install the rattle package in R and got this error message saying
configure: error: GTK version 2.8.0 required
ERROR: configuration failed for package ‘RGtk2’
Then I tried to fix the RGtk2 problem using this guide
http://marcoghislanzoni.com/blog/2014/08/29/solved-installing-rattle-r-3-1-mac-os-x-10-9/
I tried this code in the Mac OS terminal (but this is above my understanding) :
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
sudo port selfupdate
sudo port install pkgconfig
export PATH=/opt/pkgconfig/bin:$PATH
sudo port install gtk2 +x11
export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig
It gave me this answer
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
ad-mac0630:~ caruc35$ sudo port selfupdate
Password:
Sorry, try again.
Password:
And locked down.
I also installed XCode command line tools from Apple and tried some stuff from the guide above. It didnt get the rattle package to work so I erased it.
After messing with this the rattle package does still not work and R seems not to work as it did before. For example i can´t load the xlsx package getting this error message:
Loading required package: rJava
Error: package or namespace load failed for ‘rJava’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Users/caruc35/Library/R/3.4/library/rJava/libs/rJava.so':
dlopen(/Users/caruc35/Library/R/3.4/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Users/caruc35/Library/R/3.4/library/rJava/libs/rJava.so
Reason: image not found
Error: package ‘rJava’ could not be loaded
Did I mess up when trying to change PATH? Is there a way to reset everything back to normal?
I have tried reinstalling R but the same problems still occurs.

R packages: RCurl and curl packages install failure on Linux

I hope you can help with this issue I have come across whilst installing RCurl and curl packages for R.
Rd warning: /tmp/RtmpOBkvFC/R.INSTALLd07e6c06faf4/RCurl/man/url.exists.Rd:5: missing file link ‘file.exists’
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/majaidi/R/x86_64-redhat-linux-gnu-library/3.1/RCurl/libs/RCurl.so':
/lib64/libgssapi_krb5.so.2: symbol krb5int_buf_len, version krb5support_0_MIT not defined in file libkrb5support.so.0 with link time reference
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/majaidi/R/x86_64-redhat-linux-gnu-library/3.1/RCurl’
The downloaded source packages are in
‘/tmp/RtmpX6poG4/downloaded_packages’
Warning message:
In install.packages(pkgs = pkgs, lib = lib, repos = repos, ...) :
installation of package ‘RCurl’ had non-zero exit status`
That looks like that you have different versions of libcurl.
One approch could be the following one (for your console):
wget https://cran.r-project.org/src/contrib/curl_0.9.7.tar.gz
R CMD INSTALL curl_0.9.7.tar.gz --no-test-load
ldd /home/majaidi/R/x86_64-redhat-linux-gnu-library/3.1/curl/libs/curl.so
Then you can use ldd libcurl.so to find all dependencies and shared libraries to this.
Perhaps you can find some errors and/or you have to create a new LD_LIBRARY_PATH.
Good Luck!
J_F

Jupyter notebook: error installing R packages

I'm using Ubuntu 16.04.
I have R running on my Jupyter notebook and all the packages comes with "R essentials" work fine.
However, when I try to install additional packages like "mice" or "bigmemory", the installation always fails. When it tries to do
** testing if installed package can be loaded
this is the error message that appears:
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/usr/anaconda3/lib/R/library/bigmemory/libs/bigmemory.so':
/home/usr/anaconda3/lib/R/library/Rcpp/libs/../../../../libstdc++.so.6: version 'GLIBCXX_3.4.20' not found (required by /home/usr/anaconda3/lib/R/library/bigmemory/libs/bigmemory.so)
I have tried sudo apt-get install libstdc++6
and it says my libstdc++6 is installed and already is the newest version. I don't know why the R installer cannot find it..
I figured it out!
I got frustrated and uninstalled anaconda3 completely rm -rf ~\anaconda3. After reinstalling it, I looked at the instruction for installing IRkernel. I saw this:
If this fails, search the output for something like:
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Users/[you]/anaconda/lib/R/library/rzmq/libs/rzmq.so':
dlopen(/Users/[you]/anaconda/lib/R/library/rzmq/libs/rzmq.so, 6): Library not loaded: libzmq.5.dylib
Referenced from: /Users/[you]/anaconda/lib/R/library/rzmq/libs/rzmq.so
Reason: image not found
This would mean that the R binary package of rzmq was compiled against a different version of libzmq from the one on your system.
It can be fixed by installing from source
So following the instruction I then did
install.packages('mice','/home/[usr]/anaconda3/lib/R/library/',type = 'source')
It worked! I did the same thing for 'bigmemory'. No error message and I can use them both on Jupyter notebook now.

Resources