> library('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 '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
I installed JDK9 version on my Macbook Pro
My OS is 10.12.6 Sierra
I tried to activate rJava many times.
I searched Google a lot.. but I could not solve that problem..
There are numerous issues you may find here.
incorrect rJava package
issues with JVM configuration
problems related to package sources (you need most recent release of clang to compile most recent version of rJava)
there are issues with R and it's configuration utility for JVM configuration.
In general, there is no easy solution you can apply for each and every environment. Take a look here:
http://www.owsiak.org/r-3-4-rjava-macos-and-even-more-mess/
I have collected sources of most of the issues you can find while working with JVM and R. Also, pay attention to JDK 9 - it no longer comes with JRE. In past, JRE was internal part of JDK.
In general, I don't think you can solve this issue without, at least, little bit of work.
For all the helping people with comments: "This link may provide ...". Just take a look at the content and you will know why I don't copy-paste it here ;)
Related
Here's the error I get:
> library(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 '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: #rpath/libjvm.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
Reason: image not found
I see this is by no means a unique problem.. I've tried the solutions here, here and here. No success.
Some more details: I'm using R GUI, but I also can't load rJava through R terminal. I also didn't have any issue with rJava on R 3.3.s
You have two options here:
get older release of R and use precompiled version of rJava
get rJava sources and compile it for yourself
Note that rJava (most recent sources) require some features that are not embedded inside XCode and clang that is available via AppStore. You will need to do some low level stuff when it comes to building rJava package.
You can find detailed instruction here: http://www.owsiak.org/r-3-4-rjava-macos-and-even-more-mess/
If you decide to use older release of R, it's still a struggle to get it working, but way less to do: http://www.owsiak.org/r-java-rjava-and-macos-adventures/
JAVA_HOME path is different for different version of MAC OS.
In some cases there is /jre folder and in some cases it is not after /Home director manually go towards /server folder with CD command in terminal and using pwd copy the entire path use that to set the java.home then you can easily load rJava library. This is how I was able to fix the issue
options("java.home"="/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/lib")
Sys.setenv(LD_LIBRARY_PATH='$JAVA_HOME/server')
dyn.load('/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/lib/server/libjvm.dylib')
library(rJava)
I'm a TA in a statistics class, and the students are supposed to use the "asbio" package in r for multiple comparisons. Some of those who have OSX are complaining that asbio will not load. I cannot reproduce the error on my own mac.
Here are the errors one of the students is seeing:
>library(asbio)
Loading required package: tcltk
Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so, 10): Library not loaded: /opt/X11/lib/libX11.6.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.1/Resources/library/tcltk/libs/tcltk.so
Reason: image not found
Error: package ‘tcltk’ could not be loaded
> install.packages("tcltk")
Warning in install.packages :
package ‘tcltk’ is not available (for R version 3.1.1)
Here are a few things students have tried:
install tcltk2: "It works now, but I still get errors" (Sorry, I know that's a confusing answer, but it's what I have)
install xquartz: "Now it works."
I suspect that xquartz is the right answer here, but if anybody could explain what's going on and confirm, that would be awesome.
(And why the ^& would a numerical statistics package need tcl/tk anyway???)
tcl/tk needs an X11 environment to work in for graphical output and Apple no longer ships an X11 environment with their operating system. XQuartz fills that gap, but is a separate install. Said install makes the X11 libraries available (look at the missing libraries in your errors) and those libraries—in turn—make graphical operations with tcl/tk possible.
the absio package has functions that let you do animation (like anim.ci) which rely on the graphics capabilities of tcl/tk.
A student in the class posted the following instructions:
1) Install xquartz. You don't need to click it ever again after installing it.
2) Restart computer.
3) Open Rstudio (or whatever R). Run library(tcltk). Don't use require or install.packages for it. Computer should now open up xquartz on its own.
4) Run install.packages("asbio")
5) library(asbio)
6) You should be able to run pairw.anova.
(I'm still waiting to see if the student wants credit by name here, but in any case, I'm thankful to them.)
I'm trying to install the R package ggplot2, though the error that I am getting seems unrelated to that specific package. I am running on Mac OSX 10.6.8. The error message is at the bottom of this message. What happened was:
I opened up R and typed install.packages("ggplot2"). After typing this, an X11 window opened saying that I should update to the latest version of X11. I clicked through and updated X11. The install went through fine, ending with a big green check mark.
Then, I thought, "let me check if R is up to date as well, as the ggplot documentation suggests updating R before installing ggplot". So I opened up R, and clicked "check for updates". Lo and behold! an update appeared. I downloaded and installed the update. The install went through fine, ending with a big green check mark.
When I opened R, I typed install.packages("ggplot2") and I got the message below:
> install.packages("ggplot2");
--- Please select a CRAN mirror for use in this session ---
Error: .onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object
'/Library/Frameworks/R.framework/Versions/3.0/Resources/library/tcltk/libs/tcltk.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/tcltk/libs/tcltk.so, 10):
Library not loaded: /usr/X11/lib/libfreetype.6.dylib
Referenced from: /usr/local/lib/libtk8.6.dylib
Reason: Incompatible library version: libtk8.6.dylib requires version 14.0.0 or later, but libfreetype.6.dylib provides version 13.0.0
Your help is greatly appreciated. Thanks.
Try installing the latest version of XQuartz. It worked for me.
Has anybody succeeded in installing this lately? I am aware of an existing thread that addresses this, but I haven't been able to make it work. Also, it's from 2010 so maybe there's a more up-to-date approach?
Specifically, I have tried to work with these:
R version 3.0.1 (2013-05-16) -- "Good Sport"
RGtk2_2.20.25
cairoDevice_2.19
GTK_2.18.5-X11
echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/local/mysql/bin
echo $PKG_CONFIG_PATH
/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig:
and following several instructions found online, but every time I try to:
R
>library(RGtk2)
I am always prompted with the error:
Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load
shared object
'/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RGtk2/libs/RGtk2.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RGtk2/libs/RGtk2.so,
6): Library not loaded:
/Library/Frameworks/GTK+.framework/Versions/2.24.X11/Resources/lib/libgtk-x11-2.0.0.dylib
Referenced from:
/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RGtk2/libs/RGtk2.so
Reason: image not found
Clues? Thanks a lot.
I solved it by installing GTK from http://r.research.att.com/libs/GTK_2.24.17-X11.pkg and XQuartz from https://www.xquartz.org/. Errors when loading rattle package can be solved in the same way.
I have installed the latest versions of R (2.15.2) and Java (7.11), and through RStudio (0.97.310) I am trying to load the rJava package. It seemed to install properly, but when I call library(rJava) I get the following error:
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: stop("No CurrentVersion entry in '", key, "'!
Try re-installing Java and make sure R and Java have matching architectures.")
error: object 'key' not found
Error: package/namespace load failed for ‘rJava’
The documentation for rJava makes reference to Java 1.5+, so I am wondering if I need to install an ancient version of Java to resolve this problem. Any help would be much appreciated!
Ok, I figured it out. Guess I should have read the release notes on the rJava development website. I had installed Java, but not the JDK. Once I installed that, everything worked fine.
I had this problem and solved it by downloading and installing Java 64-bit (which you should probably choose if you have a modern computer) from the Java download site.