R warnings when starting rpy2 and installation

On Fedora 15

When I start rpy2 using this command

import rpy2
from rpy2 import robjects

I was getting these annoying warnings, which do not appear when starting a pure R session:

During startup - Warning messages:
1: package ‘methods’ was built under R version 2.15.1 
2: package ‘datasets’ was built under R version 2.15.1 
3: package ‘utils’ was built under R version 2.15.1 
4: package ‘grDevices’ was built under R version 2.15.1 
5: package ‘graphics’ was built under R version 2.15.1 
6: package ‘stats’ was built under R version 2.15.1

I decided to install the newest version of R (2.15.2), which is not available under my current distribution (Fedora 15). So, I got the source files from the R web page and unpack the source into a directory. I then configure and compile it:

./configure --enable-R-shlib
make

Then, just type

make install

Note: I first started without the –enable-R-shlib option and abruptly stop the compilation to reconfigure. After typing make and waiting a while I got this error:

/usr/bin/ld: CConverters.o: relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC
  CConverters.o: could not read symbols: Bad value
  collect2: ld returned 1 exit status

The solution was to restart the installation from scratch.

Then, I started ipython and tried to import rpy2 again but got an error related to a missing libR.so (despite the usage of –enable-R-shlib option)

>>> import rpy2.robjects
ImportError: libR.so: cannot open shared object file: No such file or directory

quit ipython and fix the issue by telling your system where to find the library (use locate libR.so):

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib64/R/lib/

Starting again ipython and the rpy2 import, I got another error message….:

>>> import rpy2.robjects
cannot find system Renviron
Fatal error: unable to open the base package

Here, the R_HOME is missing:

R_HOME=/usr/local/lib64/R

and now everything seems to work without warnings, which was the original issue…

Please follow and like us:
This entry was posted in Computer Science and tagged , . Bookmark the permalink.

4 Responses to R warnings when starting rpy2 and installation

Leave a Reply

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