Installing rgl on Ubuntu and Mac: X11 not found
Asked Answered
D

7

57

I have seen this question here: Error in loading rgl package with Mac OS X but there is no mentioning about installation error, which is my case. I cannot install rgl package, using this command in R:

source("http://bioconductor.org/biocLite.R")
biocLite("rgl")

The following error is displayed:

configure: error: X11 not found but required, configure aborted. ERROR: configuration failed for package ‘rgl’ * removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rgl’

I checked this address /Library/Frameworks/R.framework/Versions/3.2/Resources/library and there is no rgl folder, so I cannot delete aglrgl.so (or rgl.so), which is the answer to the above-mentioned question. Can you please help me with this installation problem? Thanks.

Darksome answered 4/8, 2015 at 23:9 Comment(9)
you have to install xquartzSneer
Thanks, problem solved!!!Darksome
Why are you using bioconductor to install "rgl"?Elbertine
To use nonlinear dimensionality reduction package which are in RDRToolbox. This package has rgl as its dependency.Darksome
@Sneer please post this as an answer.Minos
#9879193 @RomanLuštrikSneer
@raws I think the questions differ enough to be considered as two entities.Minos
@MatinKh perhaps you should pick the solution you found that worked on mac OS X, or write your own if it's different, for future users. This is a commonly viewed question without a green tick solution to it. Seems worth doing.Sceptic
Thank you, @Sceptic for the suggestion. I just posted an answer.Darksome
D
12

All the mentioned answers are correct; however, none is for Mac.

In my case (I am a Mac user), I solved the problem by installing XQuartz and restarting R.

Darksome answered 14/5, 2017 at 15:15 Comment(2)
I did this, no success :/Experimentalize
same, do you have to run the install on XQuartz, via xterm command line? Even trying that gave me the same issues.Smut
S
62

On Ubuntu 16.04 and 18.04, you might get this issue when trying to install rgl from CRAN:

checking for X... no configure: error: X11 not found but required, configure aborted.

ERROR: configuration failed for package ‘rgl’

Credit is due to this blog which solved my problems at installing rgl:

http://solaimurugan.blogspot.ca/2015/09/3d-data-visualization-using-r-configure.html

In case the link above disappears, the solution, as outlined in the blog is:

sudo apt-get install xorg 
sudo apt-get install libx11-dev 
sudo apt-get install libglu1-mesa-dev 

More recently, installing rgl on a fresh ubuntu 16.04 install also requires a further step (as noted in the comments below), if you get this error:

fatal error: ft2build.h: No such file or directory

This is solved with:

sudo apt-get install libfreetype6-dev

Then installing rgl from CRAN should just work.

Sceptic answered 13/5, 2017 at 18:17 Comment(6)
I did need sudo apt-get install libglu1-mesa-dev.Ephemerid
Worked for me. Thank you and the blogger.Transistorize
After following your procedure which helped me fix the first couple of error messages - I needed sudo apt-get install libfreetype6-dev after getting the R installation error message fatal error: ft2build.h: No such file or directoryErle
@AnthonyEbert, thanks, this last libfreetype6-dev did the trick for me too, the 3 libs in the post were not enough.Fairchild
@JamesHirschorn Worked for me on Ubuntu 18.04 after installing xorg, libx11-dev, libglu1-mesa-dev and libfreetype6-dev.Saveloy
Also worked for me on Ubuntu 18.04.1 after installing the same packages as @apitsch. I needed each of them.Fleischer
P
32

On Ubuntu, what worked for me was to install the package directly from the command line:

sudo apt-get install r-cran-rgl

(We have a strange setup here, so YMMV)

Prophecy answered 21/6, 2016 at 16:17 Comment(1)
Note that this may install an outdated version.Doghouse
T
12

On CentOS, what finally did the trick was installing libpng-dev:

sudo yum install libpng-devel.x86_64

Prior to this, I installed xorg, libx11, the mesa GL library, and freeglut.

sudo yum install xorg-x11-server-Xvfb.x86_64 xorg-x11-server-devel.x86_64 
sudo yum install libX11.x86_64 libX11-devel.x86_64
sudo yum install mesa-libGL mesa-libGL-devel mesa-libGLU mesa-libGLU-devel
sudo yum install freeglut.x86_64 freeglut-devel.x86_64

The way I finally figured out what was missing was to try compiling from source (download the tar.gz at cran), and examining the config.log after ./configure failed.

Traitorous answered 16/12, 2016 at 17:46 Comment(0)
D
12

All the mentioned answers are correct; however, none is for Mac.

In my case (I am a Mac user), I solved the problem by installing XQuartz and restarting R.

Darksome answered 14/5, 2017 at 15:15 Comment(2)
I did this, no success :/Experimentalize
same, do you have to run the install on XQuartz, via xterm command line? Even trying that gave me the same issues.Smut
N
5

Not sure about Mac case but on Windows I faced issues downloading the same rgl Package. Installing the RGL requires the devtools package

install.packages("devtools")
library(devtools)
install.packages("rgl")
library(rgl)
Neils answered 1/10, 2015 at 17:36 Comment(2)
For my case, installing xquartz [xquartz.macosforge.org/landing/] solved the problem. See the comment thread above.Darksome
On Linux, I've solved this problem by installing the build-dep and r-cran-rgl packages. Installing the devtools R package may have also been essential in my case, but I really can't tell.Derby
D
2

Took me a long time to figure this out on the [RHEL 3.10.0-862.14.4.el7.x86_64 x86_64 x86_64 x86_64 GNU/Linux]. The following packages are required:

libpng12-devel.x86_64
ImageMagick-c++-devel.x86_64
mesa-libGLU-devel.x86_64
libselinux-devel.x86_64
xorg-x11-apps
Duque answered 8/11, 2018 at 8:37 Comment(0)
R
1

On OpenSuse

sudo zypper install xorg-x11-devel
sudo zypper install glu-devel
Repellent answered 27/2, 2018 at 17:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.