简体   繁体   English

R 中的 Package rgl 在 Mac OS 中未加载

[英]Package rgl in R not loading in Mac OS

I installed the rgl package (0.104.16) in R (3.6.3), but it does not load.我在 R (3.6.3) 中安装了 rgl package (0.104.16),但它没有加载。 I don't get any errors.我没有收到任何错误。 It just never ends loading.它只是永远不会结束加载。 I tried reinstalling R and RStudio and also Xquartz.我尝试重新安装 R 和 RStudio 以及 Xquartz。 Nothing is working.没有任何工作。 I have Mac OS Catalina version 10.15.7.我有 Mac OS Catalina 版本 10.15.7。 Any help would be highly appreciated!任何帮助将不胜感激! Cheers干杯

Edited to add new details and suggested fixes.编辑添加新的细节和建议的修复。

This appears to be due to problems in the 2.8.0beta version of Xquartz that was released in early February.这似乎是由于 2 月初发布的 Xquartz 2.8.0beta 版本中的问题。 There are two problems:有两个问题:

  • It makes incompatible changes to libX11.6.dylib , so programs (like the CRAN binaries of rgl ) that were built for the 2.7.11 release will not work.它对libX11.6.dylib进行了不兼容的更改,因此为 2.7.11 版本构建的程序(如rgl的 CRAN 二进制文件)将无法运行。 If you build rgl (and everything else that uses X11) from source, it may be okay -- it was for me.如果您从源代码构建rgl (以及使用 X11 的所有其他东西),那可能没问题——它适合我。

  • When you uninstall it, it leaves behind two programs that run at startup: /Library/LaunchDaemons/org.xquartz.startx.plist (runs when you reboot your system) and /Library/LaunchAgents/org.xquartz.startx.plist (runs when you login).当您卸载它时,它会留下两个在启动时运行的程序: /Library/LaunchDaemons/org.xquartz.startx.plist (在您重新启动系统时运行)和/Library/LaunchAgents/org.xquartz.startx.plist (运行登录时)。 If you then install 2.7.11, these will fail to run (probably because of the libX11 change mentioned above).如果您随后安装 2.7.11,这些将无法运行(可能是因为上面提到的 libX11 更改)。 At that point, nothing in X11 works.那时,X11 中的任何内容都不起作用。

So the solution appears to be:所以解决方案似乎是:

  • Uninstall XQuartz by dragging it from the Applications/Utilities folder to the trash.通过将 XQuartz 从Applications/Utilities文件夹拖到垃圾箱来卸载它。
  • Uninstall rgl by running remove.packages("rgl") in R.通过在rgl中运行remove.packages("rgl")来卸载 rgl。
  • Delete those two files named org.xquartz.startx.plist from /Library/LaunchDaemons and /Library/LaunchAgents ./Library/LaunchDaemons/Library/LaunchAgents中删除这两个名为org.xquartz.startx.plist的文件。
  • Reboot your system to remove the processes started from those files.重新启动系统以删除从这些文件启动的进程。
  • Reinstall XQuartz 2.7.11.重新安装 XQuartz 2.7.11。
  • Reinstall rgl either from CRAN or from source.从 CRAN 或源重新安装rgl

If I'm wrong and that process doesn't work, this will almost certainly work as long as your rgl version is at least 0.105.12 (but won't give you any rgl windows):如果我错了并且该过程不起作用,那么只要您的rgl版本至少为 0.105.12(但不会给您任何rgl窗口),这几乎肯定会起作用:

# Start a new session
options(rgl.useNULL = TRUE)
library(rgl)

To see your displays, run the rglwidget() function, and they'll display in a browser or the RStudio viewer pane.要查看您的显示,请运行rglwidget() function,它们将显示在浏览器或 RStudio 查看器窗格中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM