My system environment:
Mac OS 10.10.2
X11 (XQuartz 2.7.5)
R 3.1.2
When I load and use 'rgl' package, I get following error message.
> library("rgl",lib.loc="/Library/Frameworks/R.framework/Versions/3.1/Resources/library")
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: In fun(libname, pkgname) : error in rgl_init
> plot3d(x,y,z)
Error in rgl.open(useNULL) : rgl.open failed
What's the problem?
I was already using rstudio when I got this warning. This seemed to work for me as suggested on https://cran.r-project.org/web/packages/shinyRGL/README.html.
I ran this on R console options(rgl.useNULL=TRUE)
I restarted the session using .rs.restartR()
Loaded the library again: library("plot3Drgl")
HTH ...
rgl appears to be working with RStudio. I'd make sure you have XQuartz installed on your system https://xquartz.macosforge.org/landing/ as X11 is no longer included with OS X by default. Let us know if it's still not working for you.
Start XQuartz before loading the rgl package. rgl displays images in an XQuartz window, but it does not seem to be able to open a RGL device window from within R when XQuartz is not already running. This works with Mac OS 10.11.3, XQuartz 2.7.8, R 3.2.3.
Detection of XQuartz on Mac OS is a little flaky. The latest rgl (version 0.95.1456) on R-forge might do better.
Related
I am having difficulty installing the zenplots package in R. For some odd reason when I use install.packages('zenplots') on my machine (Mac OS Catalina V-10.15.7) it installs fine... but when I try and install it on my second machine (also Mac OS Catalina V-10.15.7) and if I try and install it on my institutes server I get the following error:
Warning in fun(libname, pkgname) : couldn't connect to display ":0"
Error : package or namespace load failed for ‘loon’: .onLoad failed
in loadNamespace() for 'loon', details: call:
structure(.External(.C_dotTcl, ...), class = "tclObj") error: [tcl]
couldn't connect to display ":0".
Error: unable to load R code in package ‘zenplots’ Execution halted
I have also tried to install directly from GitHub using remotes::install_github('great-northern-diver/zenplots', force = T) but I get the same error as above.
I have even tried using install.packages("zenplots", repos="http://R-Forge.R-project.org") which works but unfortunatley this version doesn't contain all the functions found in zenplots.
My R version is above version 3.4.0, which is required for zenplots and as per the documentation I have already installed the graph package from BioConductor.
Any suggestions as to what might be the issue here?
I would guess that the R on your server was compiled without some feature required by the library. My guess: it is missing either tcltk or X11 support. To check do the following:
capabilities()
And see which features return FALSE, meaning they are not enabled.
I've followed as many threads as I can on this to resolve, but no luck. Simply can't install R package "rgl". I have Upgraded Ubuntu server 16 to R version 3.3.1.
PuTTY X11 proxy: Unsupported authorisation protocol
Warning in rgl.init(initValue, onlyNULL) :
RGL: unable to open X11 display
Warning: 'rgl_init' failed, running with rgl.useNULL = TRUE
* DONE (rgl)
I've tried these bits of advice:
Error in installing rgl package
error: installation of package ‘rgl’ had non-zero exit status
I have X11 working fine outside R:
http://www.tomsitpro.com/articles/how-to-use-x11-forwarding,2-843.html
but still get the error above.
Thanks for any help,
S.
Ok, this seems to be solved. I was root, after exiting and using:
sudo R
install.packages("rgl")
everything was ok. so it seems you must install as sudo, not root, for everything to go in the right place.
Thanks,
S.
I checked it. Everything seems to work properly... Rscript - screen
But in "related" here I see some questions about error in installing rgl. Take a look e.g. Error in installing rgl package
I'm trying to load ggplot2 library for R.
1) I've installed ggplot2 by this command. It was installed with no errors
install.packages('ggplot2', dependencies = TRUE)
2) Then i'm trying to use
library(ggplot2)
and get an error
Error : .onLoad не удалось в loadNamespace() для 'tcltk', подробности:
вызов: fun(libname, pkgname) ошибка: X11 library is missing: install
XQuartz from xquartz.macosforge.org Ошибка: не удалась загрузка пакета
или пространства имен для ‘ggplot2’
3) Now i try to install XQuartz library by
install.packages("XQuartz")
and get this
Warning in install.packages : package ‘XQuartz’ is not available
(for R version 3.1.2)
My R version 3.1.2
OS X Yosemite 10.10.2
Can you help me in installing ggplot2 pls?
The OS update deleted the /usr/X11 and /usr/X11R6 symlinks. I had to just re-install XQuartz from macosforge which will setup the symlinks again.
I got the same error message about the missing library.
Nowadays, a lot of libraries can be installed with Homebrew. For this instance it would be:
brew cask install xquartz
Newer users of Homebrew may need this command:
brew install --cask xquartz
R opens graphics windows using the standard X11 library on Macs, which is no longer part of the standard MacOS. When you try running programs that open a graphics window, you will get a message: "Error in check_for_XQuartz(): X11 library is missing: install XQuartz from xquartz.macosforge.org" and it should work
I am attempting (repeatedly) to load BiodiversityR, which automatically loads Rcmdr. BiodiversityR loads fine, according to my Rstudio window, but when it attempts to load Rcmdr, it gives me the following error message:
Loading required package: Rcmdr
Error : .onAttach failed in attachNamespace() for 'Rcmdr', details:
call: data(dune)
error: object 'dune' not found
Error: package 'Rcmdr' could not be loaded
I am working on a MacBook, using OSX 10.6.8. I have tried uninstalling and re-installing Rcmdr and RcmdrMisc, loading a bunch of Rcmdr plug-ins, and updating all installed packages that BiodiversityR and Rcmdr rely on (including vegan), to no avail. I've also restarted R, tried using R instead of Rstudio, etc. Any help on this is much appreciated.
Cecilia Hennessy LaBonte
Purdue University
I was facing the same problem, and here's how I finally managed to install Rcmdr on my mac (R 3.5.1):
1 -
install.packages("data.table", type = "source",
repos = "http://Rdatatable.github.io/data.table")
library('data.table')
install.packages('car')
library('car')
2 - Install: https://www.xquartz.org/ (XQuartz-2.7.11.dmg)
3 - Logout & login again. (or restart your Mac), and:
install.packages('Rcmdr')
4 - Confirm installation of the missing packages that will be asked to install.
5 - Launch it:
library('Rcmdr')
I hope it can help!
I am trying to install rgl package (0.92.858) for R (2.14.2) under Mac OS X (Lion 10.7.3). When I try to load it (library(rgl)), I get the following error:
Error : .onLoad failed in loadNamespace() for 'rgl', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rgl/libs/x86_64/aglrgl.so':
dlopen(/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rgl/libs/x86_64/aglrgl.so, 6): Symbol not found: __ZN3gui13OSXGUIFactory12hasEventLoopEv
Referenced from: /Library/Frameworks/R.framework/Versions/2.14/Resources/library/rgl/libs/x86_64/aglrgl.so
Expected in: dynamic lookup
I have a Mac with Norwegian keyboard. Maybe this has something to do with the issue? However, I get the same error, even though I change the language to U.S. Has anyone experienced similar problem? Any way solving it?
I was having this problem with rgl 0.93.996 on OSX 10.9.2, but then after reinstalling several times I saw "Installing rgl - error: X11 not found but required, configure aborted"
A quick search took me here https://stat.ethz.ch/pipermail/r-sig-mac/2012-March/009077.html
Then I was finally able to get it to work by downloading XQuartz https://www.xquartz.org So it was X11 that was the problem in my case.
It requires building from the source as there is a problem with the path to libpng.dylib path if using the built in source install. The process is:
1) Download the source files from http://download.r-forge.r-project.org/src/contrib/rgl_0.92.879.tar.gz
- You need to download the source files from here since you have to manually install the program.
2) Unzip the files to a convenient location. You can do this by double clicking on the .tar file
3) Open Terminal and navigate to the directory that you placed the files in. I put them on my desktop so the command is:
cd ~/Desktop
4) In Terminal run
R CMD INSTALL --with-libpng-prefix=/usr/X11/lib/ rgl
You can then delete all the files you downloaded. Note that I am running Mac OS X 10.7.3 with R 2.15.0. The specific paths may be slightly different if you are on a different version. You do not need the rgl folder or files after you install them and they can be deleted.
I was still having issues installing from source with special flags or any of the other suggestions in comments and things above. I am using Mac OS X 10.7.3 on a 64-bit MacBook Pro and R 2.15.0
I continued to get the following when loading the rgl package:
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rgl/libs/x86_64/aglrgl.so'
I tried the following sub-optimal solution works: Delete the aglrgl.so file. Then try loading the package again.
(This is a suggestion I took from a post by Duncan Murdoch
)
A quick way to delete this file is to type the following into the terminal:
open -a Finder /Library/Frameworks/R.framework/Versions/2.15/Resources/library/rgl/libs/x86_64/
In the new Finder window that pops up, delete the aglrgl.so file, and then close the window. Open the R-GUI, and try loading rgl: library("rgl"). It should work fine, and unfortunately use X11 for the 3D graphics instead of the native Quartz window. For me, this is better than nothing.
The problem is now documented on R-forge :
http://r-forge.r-project.org/tracker/index.php?func=detail&aid=1996&group_id=234&atid=946
You basically have to delete the incriminated file, aglrgl.so. R gives you the file's path in the displayed error message.
The new Mac binary version of rgl 0.92.861 installs on 2.14.2 without error and runs the example code.
Okay solution in my case (OS X Yosemite), first download the RGL source (not binaries) in http://cran.r-project.org/src/contrib/rgl_0.95.1247.tar.gz, extract it, and build the library using this command:
R CMD INSTALL --disable-cocoa --x-includes=/usr/X11/ rgl
and it works like a charm.