R session aborts on loading rgl package after update and reinstall

I performed a fresh reinstall/update (deleting both %localappdata% and %appdata%) of Rstudio and R. I installed Rtools and the rgl package, seemingly fine. However, whenever I try to load rgl, the R session aborts and I am prompted to restart. R specs:

> version
               _                                
platform       x86_64-w64-mingw32               
arch           x86_64                           
os             mingw32                          
crt            ucrt                             
system         x86_64, mingw32                  
status                                          
major          4                                
minor          2.0                              
year           2022                             
month          04                               
day            22                               
svn rev        82229                            
language       R                                
version.string R version 4.2.0 (2022-04-22 ucrt)
nickname       Vigorous Calisthenics            
> install.packages("rgl")
Installing package into ‘C:/Users/drowsey/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/rgl_0.108.3.zip'
Content type 'application/zip' length 4426219 bytes (4.2 MB)
downloaded 4.2 MB

package ‘rgl’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\drowsey\AppData\Local\Temp\RtmpUjz7RY\downloaded_packages
> library("rgl")

The version of RStudio I am using is:
RStudio 2022.02.2+485 "Prairie Trillium" Release (8acbd38b0d4ca3c86c570cf4112a8180c48cc6fb, 2022-04-19) for Windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36

rgl loads fine when using R outside of RStudio. I was able to replicate this problem on another system following the same steps (both running Windows 10). No session log is generated so I can't use that to help diagnose the issue.

Please let me know if there is additional information I can provide to facilitate diagnosing the issue. Thanks.

1 Like

I have the same problem. Did you find a solution?

It might be this issue with loading rgl in R 4.2 on Windows: rgl crashes in RStudio · Issue #11043 · rstudio/rstudio · GitHub. Try one of the workarounds of either installing the latest development version of rgl, or adding options(rgl.debug = TRUE) to your .Rprofile until the next release of rgl makes it to CRAN.

1 Like

This solution worked. Thank you Greg!

See Greg's response below - it worked for me.