简体   繁体   中英

Unable to use Rpy2

Why I try to load Rpy2 in Python, the interpreter finds the module but as soon as I try to import anything from it, it returns an error:

eg

import rpy2 # No errors, although it does not print anything

But

import rpy2.robjects 

returns the following error:

/home/jimmy/.python_easy_install/rpy2-2.3.0beta1-py2.7-linux-x86_64.egg/rpy2/rinterface/_rinterface.so: undefined symbol: Rf_translateCha rUTF8


I followed the instructions in the website:

1. Installed R with the option for shared libraries:

# <go to the R source directory>
make distclean
./configure --enable-R-shlib
make
make install

2. Added this to my .bashhrc :

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$RHOME/lib

3. And then installed rpy2 with easy_install (I also tried with pip ):

easy_install -d /home/jimmy/.python_easy_install rpy2

Why is it not working?

This is all on Linux with the latest versions of Rpy2 , R and Python .

This is likely because an older version of R is picked up at runtime.

I'd think that a better way to set LD_LIBRARY_PATH would be to do:

export LD_LIBRARY_PATH=$RHOME/lib:$LD_LIBRARY_PATH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM