Problem in installing 'RMongo' throws rJava error even though library(rJava) works fine - r

install.packages("RMongo")
doesn't works (seems like it has been deprecated.
So, I was trying to install using devtools.
devtools::install_github("tc/Rmongo")
but it gives out error
Error: package or namespace load failed for 'rJava':
.onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Users/saini/OneDrive/Documents/R/win-library/3.5/rJava/libs/i386/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
Error : package 'rJava' could not be loaded
Error: loading failed
Execution halted
*** arch - x64
Warning: package 'rJava' was built under R version 3.5.2
ERROR: loading failed for 'i386'
* removing 'C:/Users/saini/OneDrive/Documents/R/win-library/3.5/RMongo'
In R CMD INSTALL
Error in i.p(...) :
(converted from warning) installation of package ‘C:/Users/saini/AppData/Local/Temp/RtmpuEHfqO/file20f419985c01/RMongo_0.1.0.tar.gz’ had non-zero exit status
Even though library(rJava) works fine.
JDK, JRE are both 64 bit. R and R studio are also 64 bits.
Someone suggested to use
R CMD javareconf
but it doesnot recongnises javareconf.
Also, I've set Environment Variables.

Related

How does one install rJava and qdap onto RLibrary?

I was working on an assignment that requires installing a number of packages (including rJava and qdap), and I was sucessful at that. But when I installed those projects onto RLibrary, I couldn't install Java and qdap.
I got the following errors:
> library(qdap)
Error: package or namespace load failed for 'qdap':
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(jli, FALSE)
error: unable to load shared object '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib':
dlopen(/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib, 0x000A): tried: '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
> library(rJava)
Error: package or namespace load failed for 'rJava':
.onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(jli, FALSE)
error: unable to load shared object '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib':
dlopen(/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib, 0x000A): tried: '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
I then tried to install Java, Java JDK, and pkgname, but got the following errors:
Warning in install.packages :
package 'Java JDK' is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
Warning in install.packages :
package 'pkgname' is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
I'm not sure why I am getting these errors. I'm using RStudio Version 2022.12.0+353 (2022.12.0+353), and MacOS Monterey 12.5.

Error in installing R package asreml on mac

I'm not too familiar with R and are using it for Uni, and we need this asreml package for one of our classes. When I try installing it this error comes up:
Error: package or namespace load failed for ‘asreml’:
.onLoad failed in loadNamespace() for 'asreml', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/00LOCK-asreml/00new/asreml/libs/libvsninet.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/00LOCK-asreml/00new/asreml/libs/libvsninet.so, 0x0006): tried: '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/00LOCK-asreml/00new/asreml/libs/libvsninet.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/asreml’
Warning in install.packages :
installation of package ‘/Users/Cami/Downloads/asreml-4.1.0.176-macOS-10.13.2-R4.2.tar.gz’ had non-zero exit status
I tried installing it on R both with a full path to the file and with a working directory set up. I've also tried to install it directly through the computer terminal, however, the same error comes up. A tutor in class has also tried to open a library for the package through the terminal on my laptop and it also didn't work. Neither of us are sure of what 'libvsninet.so' means. I've also tried to disinstall and reinstall both R and RStudio, but the result is the same.

Error : package 'rJava' could not be loaded but library(rJava) is working

I've 64 bit machine and have installed jdk and jre(64 bit) also R and R studio is 64bit. I'm trying to install 'rMongodb' package by:
devtools::install_github("tc/RMongo")
but it gives out error
Error: package or namespace load failed for 'rJava':
.onLoad failed in loadNamespace() for 'rJava', details:
call: inDL(x, as.logical(local), as.logical(now), ...)
error: unable to load shared object 'C:/Users/saini/OneDrive/Documents/R/win-library/3.5/rJava/libs/i386/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
Error : package 'rJava' could not be loaded
Error: loading failed
Execution halted
*** arch - x64
Warning: package 'rJava' was built under R version 3.5.2
ERROR: loading failed for 'i386'
* removing 'C:/Users/saini/OneDrive/Documents/R/win-library/3.5/RMongo'
In R CMD INSTALL
Error in i.p(...) :
(converted from warning) installation of package ‘C:/Users/saini/AppData/Local/Temp/RtmpuEHfqO/file20f419985c01/RMongo_0.1.0.tar.gz’ had non-zero exit status
Even though library(rJava) works fine.
Ps. I've already set the environment variables.

rJava Package installation failed (needed for xlsx package)

When I want to install the xlsx package, I get this error :
Loading required package: rJava
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry
In addition: Warning message:
package ‘rJava’ was built under R version 3.3.3
Error: package ‘rJava’ could not be loaded
So I tried reinstalling rJava, but I get this :
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry
In addition: Warning message:
package ‘rJava’ was built under R version 3.3.3
Error: package or namespace load failed for ‘rJava’
Do you guys have any simple solution to this ? I am not very familiar with R, and I just need it to bootstrap some data.
I had the same error recently (R Error: JAVA_HOME cannot be determined from the Registry). I found the solution here. In brief, Joachim Schork identified the problem as not the xlsx package but rather the rjava package. He explained that the problem usually is, as hartmut said, running a 64 bit version of R and a 32 bit version of Java. To resolve the problem according to his recommendation, you need to download and install the 64 bit version of Java. In my case, the solution included installing Java on my machine as it was never installed previously.

Installing Bioconductor highthroughputassays workflow gives rgl errors and fail to load

When I try to install the bioconductor workflow 'highthroughputassays' as follows (and as described here):
> source("http://bioconductor.org/workflows.R")
> workflowInstall("highthroughputassays")
It installs a lot of dependent packages, but just before ending the installation it gives the following errors:
No man pages found in package ‘highthroughputassays’
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error : .onLoad failed in loadNamespace() for 'rgl', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Users/johansenkh/Library/R/3.3/library/rgl/libs/rgl.so':
dlopen(/Users/johansenkh/Library/R/3.3/library/rgl/libs/rgl.so, 6): Library not loaded: /opt/X11/lib/libGLU.1.dylib
Referenced from: /Users/johansenkh/Library/R/3.3/library/rgl/libs/rgl.so
Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/johansenkh/Library/R/3.3/library/highthroughputassays’
Warning in install.packages :
installation of package ‘highthroughputassays’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/hb/sc3x6vtj0ys009qnyplbp2_h1g5hgm/T/RtmpDkWkRH/downloaded_packages’
Because of those errors, the workflow does not load;
library(flowStats)
gives a similar error after installing packages as described above.
I have tried it on 3 different Mac computers (all with the newest OS X, but one of them had the 3.3.1 version of R (The newest version is 3.3.2))
When trying library(rgl) I get the following error:
Error : .onLoad failed in loadNamespace() for 'rgl', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Users/johansenkh/Library/R/3.3/library/rgl/libs/rgl.so':
dlopen(/Users/johansenkh/Library/R/3.3/library/rgl/libs/rgl.so, 6): Library not loaded: /opt/X11/lib/libGLU.1.dylib
Referenced from: /Users/johansenkh/Library/R/3.3/library/rgl/libs/rgl.so
Reason: image not found
Error: package or namespace load failed for ‘rgl’
I solved the problem as follows:
The problem was with loading 'rgl'.
By installing XQUARTZ (www.XQUARTZ.com) followed by restarting OS X (Log out and log in) the rgl-package worked. Thereafter the workflow installed as indicated above.

Resources