Issues Loading rgl Despite Having It Installed
Closed this issue · 4 comments
Hello! I am a student relatively new to R hoping to use the "rgl" package in order to load the "geomorph" package. I would greatly appreciate any guidance on how to solve this issue!
Session Info:
R version 4.1.0 (2021-05-18) + XQuartz 2.7.11 (xorg-server 1.18.4)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Big Sur 11.4
I have tried installing XQuartz versions 2.8.0 as well as 2.8.1 - they both did not work. After further search, I noticed that other people faced similar issues with the newer version which is why I have installed an older version now.
It looks like you're on an M1 machine. I don't have one of those to test, so you're going to have to do a lot of debugging yourself.
First, as far as I know XQuartz 2.7.11 won't work at all on your machine. You definitely need one of the newer releases for M1 support. The first thing you should do is get XQuartz working, and I can't help you much with that, other than suggesting a test to see if things work: if this doesn't work, rgl
won't.
A simple test is to run code like
quartz()
plot(rnorm(10))
The first line opens a Quartz window, which needs X11 working to run. The second is just a simple 2D plot.
Once you get that working, you may find that rgl just works. If not, please post information like what you wrote above.
Hello, and thank you for your prompt response. As you can see from the attachment below, I was able to uninstall XQuartz 2.7.11 and reinstall XQuartz 2.8.1 (following these instructions: https://stackoverflow.com/questions/66011929/package-rgl-in-r-not-loading-in-mac-os/66127391#66127391). The Quartz window and the 2D plot opened just as you described, however the library(rgl) command still did not work as the same error message popped up.
Okay, so it sounds as though XQuartz is working, but is incompatible with that build of rgl. I've only got two other suggestions:
- Install rgl from source instead of using a binary. This requires compilers etc., so it's not trivial, and it's not guaranteed to work: maybe something in your XQuartz has changed and it really is incompatible with rgl.
- Run rgl without using OpenGL, following the final suggestion in the StackOverflow answer you linked to:
# Start a new session
options(rgl.useNULL = TRUE)
library(rgl)
Thank you so much!
I uninstalled rgl using remove.packages("rgl") and reinstalled rgl by downloading the rgl_0.106.8.tar.gz file from cran.r-project.org and going to RStudio > Tools > Install Packages > Install From: Package Archive and choosing the file above. Once I did that, I was able to run library(rgl) without having to start a new session, and now my geomorph package is working as well.