Failed to load rcdk because of rJava
See original GitHub issuer$> library(rcdk)
Loading required package: rcdklibs
Loading required package: 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/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/lib/jli/libjli.dylib':
dlopen(/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/lib/jli/libjli.dylib, 10): no suitable image found. Did find:
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/lib/jli/libjli.dylib: mach-o, but wrong architecture
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/lib/jli/libjli.dylib: mach-o, but wrong architecture
Error: package ‘rJava’ could not be loaded
I came across this similar thread therefore I tried sudo R CMD javareconf
but it does not work for me.
chrislam@ChrisLams-MBP MVA_DNF % sudo R CMD javareconf
Password:
Java interpreter : /usr/bin/java
Java version : 11.0.10
Java home path : /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/include/darwin -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c conftest.c -o conftest.o
clang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/lib/server -ljvm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: ignoring file /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/lib/server/libjvm.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
JAVA_HOME : /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.
the following is my Sys.info()
and my radian details
r$> Sys.info()
sysname
"Darwin"
release
"20.3.0"
version
"Darwin Kernel Version 20.3.0: Thu Jan 21 00:06:51 PST 2021; root:xnu-7195.81.3~1/RELEASE_ARM64_T8101"
nodename
"ChrisLams-MBP.home"
machine
"arm64"
login
"root"
user
"chrislam"
effective_user
"chrislam"
chrislam@ChrisLams-MBP MVA_DNF % radian
R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Platform: aarch64-apple-darwin20 (64-bit)`
chrislam@ChrisLams-MBP ~ % java -version
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Rcellminer failing to load because of rcdk
Setenv() but to no avail. My current system java is : openjdk version "1.8.0_92". OpenJDK Runtime Environment (Zulu 8.15.0.1-macosx) (build 1.8 ...
Read more >Problems when trying to load a package in R due to rJava
Its because either one of the Java versions(32 bit/64 bit) is missing from your computer. Try installing both the Jdks and run the...
Read more >Using the CDK from R
The CDK is a Java library for cheminformatics that supports a wide ... However, since it loads all the molecules from the specified...
Read more >error: JAVA_HOME cannot be determined from the Registry
After installing and loading the xlsx package, the error “JAVA HOME cannot be found from the Registry” was returned to the R interface....
Read more >bunk@debian.org: Bug#982111: r-cran-rcdk: autopkgtest failure
Loading required package: rcdklibs. Loading required package: rJava. Error: package or namespace load failed for 'rcdk': .onLoad failed in loadNamespace() ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah this line in the error
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/lib/jli/libjli.dylib: mach-o, but wrong architecture
Means you have mixed architectures. On Apple Silicon all components need to be either x86, so the whole kit and caboodle is emulated via Rosetta or all arm64 so everything is native. Looks like your R is native (arm64), meanwhile AdoptOpenJDK does not yet have a native JDK/JRE. You can install a native one from homebrew: https://formulae.brew.sh/formula/openjdk#default Or from Azul: https://www.azul.com/downloads/?os=macos&architecture=arm-64-bit You may need to install the package from source, but I think most if not all CRAN packages are now arm64 aware.If you need to use Adopt specifically, download x86 R and use that with your AdoptOpenJDK (with a speed penalty).
seems it does not work, I tried their to install by
devtools
as suggested by CDK-R repobut still not success. I think the most problematic is the dependence
rcdklibs
.