View Full Version : [ubuntu] install and compile R and rpy2

May 21st, 2010, 08:43 PM
I am trying to install a dev version of the R software and to compile it with the option --enable-R-shlib, in order to install Rpy2 (an interface from R to Python).
I did :
sudo apt-get install r-base-dev
But I do not know where the packages were downloaded, and how can I compile them.
Have anyone tried to do that? and more generally have you some experience with rpy2?

Thanks a lot

May 21st, 2010, 09:14 PM
Open a terminal and type

apt-get source r-base
This will download the source files in your home directory.


All the necessary info on how to compile from source is in the above.

May 21st, 2010, 10:02 PM
Thanks a lot.
When I try ./configure ./configure --enable-R-shlib
It works till this error message :

checking for X... no
configure: error: --with-x=yes (default) and X11 headers/libs are not available

any ideas on that?

May 21st, 2010, 10:08 PM

Unless you do not want to view graphs on-screen you need ‘X11’ installed, including its headers and client libraries. For recent Fedora distributions it means (at least) ‘libX11’, ‘libX11-devel’, ‘libXt’ and ‘libXt-devel’. On Debian we recommend the meta-package ‘xorg-dev’. If you really do not want these you will need to explicitly configure R without X11, using --with-x=no.

sudo apt-get install xorg-dev

May 21st, 2010, 10:08 PM
I tried
./configure ./configure --enable-R-shlib --with-x=no
and it seems to work.
I think I will not have the X interface :-(

February 9th, 2012, 02:46 AM
So I'm trying to do the same thing. I was getting the import error using rpy2 and found out I need to compile R as a shared library. I proceeded to get the source for r-base and configure to enable share library. I installed R. When I went to try rpy2 again in python I still had the same import error

ImportError: libR.so: cannot open shared object file: No such file or directory

I did a locate on libR.so and it doesn't exist. Why isn't it being installed?