MacOS High Sierra和R软件包之间的冲突

时间:2018-01-30 20:15:02

标签: r packages rjava macos-high-sierra

我正在运行MacOS 10.13(High Sierra),最近更新为R版本3.4.3和R studio版本1.1.419。由于某种原因,rJava包没有工作...在stackoverflow上尝试了几个修复,没有任何作用。此外,摘要包将不会加载,所以我不能再使用ggplot2。有什么建议吗?

Java错误:

    > library("rJava", lib.loc="/Library/Frameworks/R.framework/Versions/3.4/Resources/library")
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

摘要包错误:

    > library("rJava", lib.loc="/Library/Frameworks/R.framework/Versions/3.4/Resources/library")
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

2 个答案:

答案 0 :(得分:1)

新的Mac OSX版本记录了在R / RStudio中弄乱Java路径的问题(参见here)。看起来这就是你在这里遇到的情况。

如果您查看我上面链接的问题,希望您能找到一个可以重置路径的解决方案;以下两个命令对我有用。

dyn.load('/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/lib/server/libjvm.dylib')

sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib

答案 1 :(得分:0)

我不知道rJava的问题,但digest刚刚更新,所以如果你尝试安装二进制文件,它可能还没有编译和构建。如果发生这种情况(这有点像竞争条件/滞后),您可以尝试重新安装表单来源:

install.packages("digest", type = "source")