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

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.

Related

Error: package or namespace load failed for ‘RCurl’ in dyn.load(file, DLLpath = DLLpath, ...):

Error: package or namespace load failed for ‘RCurl’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/00LOCK-RCurl/00new/RCurl/libs/RCurl.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/00LOCK-RCurl/00new/RCurl/libs/RCurl.so, 0x0006): Library not loaded: '#rpath/libcurl.4.dylib'
Referenced from: '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/00LOCK-RCurl/00new/RCurl/libs/RCurl.so'
Reason: tried: '/Library/Frameworks/R.framework/Resources/lib/libcurl.4.dylib' (no such file), '/Library/Java/JavaVirtualMachines/jdk-17.0.1+12/Contents/Home/lib/server/libcurl.4.dylib' (no such file)
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RCurl’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/RCurl’
Warning in install.packages :
installation of package ‘RCurl’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/9m/2mfljv2d3bbc0gdnxk892dzm0000gn/T/RtmpiKY9tT/downloaded_packages’
I found some solutions on Linux. On macOS, I don't see any solution.
I ran into the same issue. For me the issue was the conflicting curl-config installed system-wide on mac and the curl-config in my base conda environment that was getting auto-activated.
Steps that worked for me.
Run conda deactivate to deactivate the conda environment
Start R
Run the package installation again (install.packages("RCurl")).

How do i install the "nloptr" package correctly on my MAC?

I tried to install the "nloptr" package in R. (I have a Mac) I have "nlopt" already installed but still get the following error when I try to install "nloptr".
Error: package or namespace load failed for ‘nloptr’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-nloptr/00new/nloptr/libs/nloptr.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-nloptr/00new/nloptr/libs/nloptr.so, 6): Symbol not found: _nlopt_add_equality_constraint
Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-nloptr/00new/nloptr/libs/nloptr.so
Expected in: flat namespace
in /Library/Frameworks/R.framework/Versions/3.6/Resources/library/00LOCK-nloptr/00new/nloptr/libs/nloptr.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/nloptr’
Warning in install.packages :
installation of package ‘nloptr’ had non-zero exit status
Can someone please help me with this?

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

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.

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.

cannot load R package 'tm.plugin.webmining'

I'm using x64 windows 7 and R i386 3.1.1
I installed 'tm.plugin.webmining' package. but when I load this package using
library(tm.plugin.webming)
flowing error occure:
Error : .onLoad is failed at loadNamespace() because of 'rJava':
Call: inDL(x, as.logical(local), as.logical(now), ...)
Error: Cannot load 'C:/Program Files/R/R-3.1.1/library/rJava/libs/i386/rJava.dll':
LoadLibrary failure: Cannot find the module.
I already installed latest jvm. But it doesn't work.
try setting the Java_Home path on R
Sys.setenv(JAVA_HOME="path/java/home")
ie
Sys.setenv(JAVA_HOME=C:/Program Files/Java/jdk1.8.0_05/bin")

Resources