I’ve tried the installation (which terminates successfully) of rpy2 both from source (python setup.py install) and macports, and upon trying to import rpy2, I’m getting this error:
/Library/Python/2.7/site-packages/rpy2/rinterface/__init__.py in <module>()
76
77
---> 78 from rpy2.rinterface._rinterface import *
79
80
ImportError: dlopen(/Library/Python/2.7/site-packages/rpy2/rinterface/_rinterface.so, 2): Library not loaded: /Library/Frameworks/R.framework/Versions/2.13/Resources/lib/libR.dylib
Referenced from: /Library/Python/2.7/site-packages/rpy2/rinterface/_rinterface.so
Reason: image not found
I can’t seem to figure this out, any idea?
Thanks!
The Python bindings depend on a working R installation. Based on the file paths shown, the traceback you give must be from your source install and it is not finding the R framework or libraries, which would not be in that location (
/Library/Frameworks) if installed by MacPorts. Your best bet is to stick with the complete MacPorts solution. That raises the question of which version of the rpy2 bindings you installed. At the moment, MacPorts shows three available versions:py25-rpy2,py26-rpy2, andpy27-rpy2. Each one is installed into the corresponding MacPorts Python version. So if you installedpy27-rpy2, you need to invoke the MacPortspython2.7. From a terminal shell, try: