Install RGL in Ubuntu

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:


Detailed Log

Thanks to Dirk Eddelbuettel for the following tip. He points out that, rather than all the guess-and-check below, he points out:

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.

I’ll be sure to do that next time! For posterity’s sake, here was the detailed log of my first attempt.

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.

One Comment

  1. Vishiv says:

    Thanks a lot to you and to have post the answer of Dirk Eddelbuettel !!!
    The first method doesn’t work for me. Perhaps a probleme of version.
    I did have the Open GL librairies for dev because I have progam in Opengl !…
    But R didn’t want to intall the rgl package with in particular this message at the begining of check of Open GL :
    GL/gl.h usability… no !!!
    I tried many solutions on google but this made all :

    sudo apt-get build-dep r-cran-rgl

    After I intalled the package rgl in R and the installation complete

    Thanks again (i will work now !)
    (I rarely post but here it was very usefull !)


  1. Graphical Tools (rgl) on a Headless Shiny Server | Trestle Technology - [...] Once you have XVFB setup, you’re ready to install rgl (or whatever other graphical package you’re looking for). If …

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">