R unable to load package Snowball, rJava - r

I am trying to get the R package "lsa" running, which in turn requires Snowball, which in turn fails. I'm running OpenSUSE 12.2 with the latest R-patched build (currently 3.01). Here's the thing: the libraries load no problem if I do "sudo R" but if I try to run R the good way, in emacs ESS mode, I don't have sudo and the attempt fails. Here's what I see:
library(lsa)
Loading required package: Snowball
Error : .onLoad failed in loadNamespace() for 'Snowball', details:
call: NULL
error: .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/usr/lib64/R/library/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
Error: package ‘Snowball’ could not be loaded
This is at the conclusion of a long string of rJava issues.
Suggestions on how I can get this running without sudo (running sudo R just seems dumb, in addition to being a problem for ESS mode)

Related

rJava loading and executing in shell but not in cron

I am facing a unusual problem on CENTOS 7 system with R 3.6.x. This involves working with rJava Package.
Steps i'm taking to run in root,
sudo -i changing to root
Rscript /opt/mount1/code.R
When triggered from bash from /opt/mount1/code.R the code works fine both in personal account and root access.
when the same script is triggered through root's cron scheduler, the Rscript is executed, but unable to load rjava
I have checked the /opt/R/3.6.3/lib/R/library/rJava/libs/rJava.so' existing in this location and works without issue when triggered in terminal.
I also ran a test script in cron to see the R.home file.path(R.home("bin"), "R") this also outputs "/opt/R/3.6.3/lib/R/bin/R"
Please excuse my terminology if its not right.
Any help or guidance is appreciated.
This is the error
> Loading required package: DBI 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
> '/opt/R/3.6.3/lib/R/library/rJava/libs/rJava.so': libjvm.so: cannot
> open shared object file: No such file or directory Error: package
> ‘rJava’ could not be loaded
> Execution halted

Unable to load rJava using Rscript on Ubuntu 18.04

I am running Ubuntu 18.04 on an AWS EC2 instance and I am having trouble loading the rJava package when I run the script from the console or within a base-r (v 3.4.4) session.
The package loads fine within RStudio-server via the browser with no errors but if I run it from the console or within base-r (typing R in the console) I get the following error:
Error: package or namespace load failed for ‘mailR’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/home/ubuntu/R/x86_64-pc-linux-gnu-library/3.4/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
The suggested 'duplicate' is all about editing RStudio files etc. but I don't have any issues loading rJava within RStudio, the issue is I can't load rJava from the terminal using RScript or within an R session.

Error loading rJava.so when using ReporteRsjars

I am running R 3.5.0 on a Ubuntu 18.04 machine. Some Shiny app I am testing with this new environment uses the ReporteRsjars package and gives the following error message on loading this package:
Loading required package: ReporteRsjars
Error: package or namespace load failed for ‘ReporteRsjars’:
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/usr/local/lib/R/site-library/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
Warning: Error in : package ‘ReporteRsjars’ could not be loaded
The file /usr/local/lib/R/site-library/rJava/libs/rJava.sohowever does exist.
Any help would be appreciated!
After quite some more trying I found the solution - and realized that I mis-interpreted the error message: The missing library was actually the libjvm.so which was not found. A symlink
ln -s /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so /usr/lib
followed by a R CMD javareconfand a removal and re-installation of the rJavapackage did it for me.

Unable to install R package Cairo

I am trying to install the package Cairo on RedHat running R version 3.2.3. So far I have tried:
install.packages("Cairo")
R CMD INSTALL Cairo_1.5-9.tar.gz
Both the approaches giving me the same error below.
Error : .onLoad failed in loadNamespace() for 'Cairo', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/home/sandeep/R/x86_64-pc-linux-gnu-library/3.2/Cairo/libs/Cairo.so':
libpng15.so.15: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
I have tried the same logging in as root. Only the path for the shared library was different, error remained the same.
I have also tried installing packages mentioned below using
yum install cairo cairo-devel cairomm-devel libjpeg-turbo-devel pango pango-devel pangomm pangomm-devel
Also, I have X11 libraries installed.

Error loading rJava in R (Ubuntu 12.04)

I had some issues installing rJava first. Then I found this solution.
Unfortunately I get following error, when loading the package:
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/informatik2/students/home/1jendryc/R/x86_64-pc-linux-gnu-library/3.1/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
Error: package or namespace load failed for ‘rJava’
Still this file exists and even the path is correct
~/R/x86_64-pc-linux-gnu-library/3.1/rJava/libs$ ls
rJava.so
So I tried that approach, but it didn't worked.
I have no possibility to get root easily, cause I am working at my university at a pool computer.
Cheers.
Your issue is something different. What message says is that it can't find "libjvm.so". You need to properly configure Java, rJava and R. Take a look here
http://www.owsiak.org/?p=3671
where all the caveats are listed when it comes to working with R and Java.

Resources