Errors during installation of R dependencies after new R installation on Ubuntu 18.04 - r

System: Ubuntu 18.04
Original error that showed up that prompted me to try to reinstall R and dependencies:
Error: package or namespace load failed for 'lubridate' in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/usr/local/lib/R/site-library/stringi/libs/stringi.so': libicui18n.so.57: cannot open shared object file: No such file or directory
Steps to reproduce:
Install R: apt install r-base
Try to install R dependencies: install.packages(c("dplyr", "lubridate", "qcc", "forecast"), repos='http://cran.us.r-project.org')
Error that displays during installation:
/usr/local/lib/R/site-library/BH/include/boost/smart_ptr/scoped_ptr.hpp:74:31: warning: 'template<class> class std::auto_ptr' is deprecated
Error that displays after installation:
The downloaded source packages are in
'/tmp/RtmpnulsEe/downloaded_packages'
Warning message:
In install.packages(c("dplyr", "lubridate", "qcc", "forecast", "stringi"), :
installation of package 'forecast' had non-zero exit status
After purging and reinstalling r-base and R dependencies, I'm seeing this...(already checked that libcurl4-openssl-dev was latest version):
Error: package or namespace load failed for 'forecast' in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/usr/local/lib/R/site-library/curl/libs/curl.so':
/usr/lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by /usr/local/lib/R/site-library/curl/libs/curl.so)
Update: Apparently it's something in the forecast library, because I reproduced that error like this:
$ R
> library(forecast)
Error: package or namespace load failed for 'forecast' in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/usr/local/lib/R/site-library/curl/libs/curl.so':
/usr/lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_3' not found (required by /usr/local/lib/R/site-library/curl/libs/curl.so)

Your original problem is that stringi was built against a distro package version of libicu which changed. As this distribution package does not know you have lubridate in /usr/local it changes and breaks things.
There are a number of ways to fix this. The easiest (and narrowest) is to make sure you have libicu-dev installed. You could then reinstall (ie: rebuild stringi) after which lubridate will load.
For the rest you are just going somewhat wild throwing everything that is moveable up against the wall. You need to take a moment to realize that you can either install all these as binaries (ie from the Michael Rutter PPAs at launchpad), or from source. Your call. I have an older answer explaining the difference here (as well as in other follow-ups here) and we help on the r-sig-debian list too.
But in short: read this README at CRAN (esp first few paragraphs) and consider the PPAs.

After trying the following (purging and reinstalling R between each step):
apt purge r-base
Added/removed several different PPAs before realizing none of them supported Bionic Beaver. Result: Release not found.
Found Michael Rutter's PPA and attempted to use that. Result: same error message from above ('CURL_OPENSSL_3' not found).
Attempting several solutions to this SO article. Result: same error message from above ('CURL_OPENSSL_3' not found).
Read this article and performed the following in R:
> remove.packages("curl")
> install.packages("curl")
> install.packages(c("dplyr", "lubridate", "qcc", "forecast", "stringi", "curl"), repos='http://cran.us.r-project.org')
And everything worked as intended.

Related

R tcl issue on shared HPC cluster environment

I've been having some issues getting R to run properly on the shared cluster at my institution , where i don't have root access. Some things will work but it gets tricky when i need to install packages etc. The current issue i'm trying to trouble shoot is the following error when trying to load the caret package:
Loading required package: lattice
Loading required package: ggplot2
Error: package or namespace load failed for ‘ggplot2’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/cifs/hariri-long/Scripts/Tools/R/packages/rlang/libs/rlang.so':
/cifs/hariri-long/Scripts/Tools/R/packages/rlang/libs/rlang.so: undefined symbol: R_removeVarFromFrame
Error: package ‘ggplot2’ could not be loaded
Execution halted
I found this page suggesting i install rlang as follows:
> install.packages("rlang",type="source")
Installing package into ‘/cifs/hariri-long/Scripts/Tools/R/packages’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Error: .onLoad failed in loadNamespace() for 'tcltk', details:
call: fun(libname, pkgname)
error: Can't find a usable init.tcl in the following directories:
/usr/share/tcl8.5 ./lib/tcl8.5 ./lib/tcl8.5 ./library ./library ./tcl8.5.13/library ./tcl8.5.13/library
but i get the above tcl error. since i've seen this in other threads:
> capabilities("tcltk")
tcltk
TRUE
it looks like tcl on my system is 8.6, but i don't know how to tell R to look for that version.
$ whereis tcl
tcl: /usr/lib64/tcl8.6 /usr/include/tcl.h /usr/share/tcl8.6
$ which R
/opt/apps/rhel7/R-3.6.0/bin/R
Any ideas? The OS is CentOS 8. Thanks!
I ended up deciding to try using a more recent R version (4.1.1) to solve this issue. I was hesitant to do this at first because I have run into issues with availability / compatibility of packages I need in more recent R versions, but I wasn't getting anywhere troubleshooting this issue otherwise. I figured that since TCL 8.6 is what was installed on the system, a newer version of R might be able to work with it, and seems i was right, since I got past the first error I was having when I switched.
I did get a new error regarding an issue loading the shared library Libtk8.6.so. So I downloaded the .so file from here and unpacked it to my home directory using rpm2cpio (i don't have root access so i can't just use yum install etc). After that i just had to re-install all my packages for the new R version and it worked!

Installed rJava, Installed Java 8 update. Still cannot load rJava on MacOS Sierra

Bear in mind that I am computer illiterate and new to R. I have installed the rJava package in R studio version 1.0.143 and installed Java 8 (using MacOS Sierra). When I try to load the rJava package:
library(rJava)
I get the following error
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
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/cormac/Library/R/3.4/library/rJava/libs/rJava.so':
dlopen(/Users/cormac/Library/R/3.4/library/rJava/libs/rJava.so, 6):
Library not loaded: #rpath/libjvm.dylib
Referenced from:
/Users/cormac/Library/R/3.4/library/rJava/libs/rJava.so
Reason: image not found
In addition: Warning messages:
1: package ‘rJava’ was built under R version 3.4.2
2: running command '/usr/libexec/java_home' had status 1
Could somebody help me to interpret this error message? There is probably a very simple solution, but I am completely lost. Thank you!!
As noted in Unable to load rJava in RStudio, there is a very specific sequence of steps that must be taken to get rJava to work on a Macbook, as documented in rJava Issues #86.
Download and install Java from Oracle
Uninstall any previously installed version of rJava
Add JAVA_HOME to your .bashrc
Close & restart terminal, R and RStudio sessions so they pick up the updated JAVA_HOME
Use install.packages() to install rJava
See the URL link above for additional details on each step.

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