Install RGL in Ubuntu
- October 14th, 2012
- Posted in Personal
- Write comment
I had a few hurdles to get through when trying to install the “rgl” R package in Ubuntu. In summary, here was my solution:
From the terminal:
sudo apt-get install r-cran-dev xorg-dev libglu1-mesa-dev
Then from R:
install.packages("rgl")
Detailed Log
The first snag I hit was the following implying I was missing some necessary X code:
checking for X... no configure: error: X11 not found but required, configure aborted. ERROR: configuration failed for package ‘rgl’
You’ll need the `xorg-dev` package to get around this issue. I then hit an error regarding a `GL` library:
checking for X... libraries , headers checking GL/gl.h usability... no checking GL/gl.h presence... no checking for GL/gl.h... no checking GL/glu.h usability... no checking GL/glu.h presence... no checking for GL/glu.h... no configure: error: missing required header GL/gl.h ERROR: configuration failed for package ‘rgl’
A quick Google showed that the `libglu1-mesa-dev` package contained these headers. Once I had installed those package, the install process went smoothly!
Note, too, that there may be a precompiled package may be available for your distribution under the name r-cran-rgl. In my case, I needed a more recent version of the package than was offered there, hence this exploration.
Very useful tip indeed. Thanks!
Why not just do ‘sudo apt-get install r-cran-rgl’ ?
Sincerely, the package maintainer
Or… if you want to install from newer sources, ‘sudo apt-get build-dep r-cran-rgl’ will install all dependencies needed to builds the package saving you the guesswork,
Thanks for this very useful tip. Didn’t know about the build-dep trick – very neat!
I needed the most recent version which wasn’t in the repo yet, but I was unaware of your “build-dep” trick. I’ll have to keep that in mind; thanks!
Note to self: just had a similarly tedious time setting this up on AMI Linux on EC2. The trick there was to install libpng, even though the error was complaining about the absence of X11.
thanks man!