R warnings when starting rpy2 and installation

On Fedora 15

When I start rpy2 using this command

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

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:

Then, just type

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:

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)

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

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

Here, the R_HOME is missing:

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

This entry was posted in Computer Science and tagged , . Bookmark the permalink.

4 Responses to R warnings when starting rpy2 and installation

  1. Arulraj Anto says:

    [root@sys-1605 ~]# python -c “import rpy2.robjects”
    Traceback (most recent call last):
    File “”, line 1, in
    File “/usr/local/python2.7/lib/python2.7/site-packages/rpy2/robjects/__init__.py”, line 12, in
    import array
    ImportError: /usr/local/python2.7/lib/python2.7/lib-dynload/array.so: undefined symbol: PyUnicodeUCS2_FromUnicode

    Please help me to resolve this issue.

  2. Arulraj Anto says:

    [root@sys-1605 lib]# export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/R-2.15.2/lib64/R/lib/
    [root@sys-1605 lib]# python
    Python 2.7.11 (default, Apr 7 2016, 19:08:08)
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
    Type “help”, “copyright”, “credits” or “license” for more information.
    >>> import rpy2.robjects
    Traceback (most recent call last):
    File “”, line 1, in
    File “/usr/local/python2.7/lib/python2.7/site-packages/rpy2/robjects/__init__.py”, line 12, in
    import array
    ImportError: /usr/local/python2.7/lib/python2.7/lib-dynload/array.so: undefined symbol: PyUnicodeUCS2_FromUnicode
    >>>

  3. Anonymous says:

    I just wanted to say, I’ve come back to this post several times when I’ve hit problems with rpy. Very helpful post, thank you!

  4. Anonymous says:

    Thank you!

Leave a Reply

Your email address will not be published.