Question

I have had a python script that uses rpy2 internally. This script was working until very recently. However, it stopped working now. I got an error that I had not seen previously. I can reproduce the error with the following lines of code:

$ python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import rpy2.robjects as robjects
cannot find system Renviron
Error in getLoadedDLLs() : there is no .Internal function 'getLoadedDLLs'
Error in checkConflicts(value) : 
".isMethodsDispatchOn" is not a BUILTIN function
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.6/site-packages/rpy2-2.2.5dev_20120328-py2.6-macosx-10.6-    universal.egg/rpy2/robjects/__init__.py", line 17, in <module>
from rpy2.robjects.robject import RObjectMixin, RObject
File "/Library/Python/2.6/site-packages/rpy2-2.2.5dev_20120328-py2.6-macosx-10.6-universal.egg/rpy2/robjects/robject.py", line 9, in <module>
class RObjectMixin(object):
File "/Library/Python/2.6/site-packages/rpy2-2.2.5dev_20120328-py2.6-macosx-10.6-universal.egg/rpy2/robjects/robject.py", line 22, in RObjectMixin
__show = rpy2.rinterface.baseenv.get("show")
LookupError: 'show' not found

I do not why this should not work. Is there any way to fix this.

Was it helpful?

Solution 2

rpy2-2.2.5 belongs to the previous series (2.2.x), and was working with older versions of R (R keeps evolving).

The current releases of rpy2 are in the 2.3.x series (latest is 2.3.6), but they require Python 2.7, or Python 3.3 (if you want the latest R, you'll have to get a recent Python ;-) )

OTHER TIPS

This page describes a potential solution for this problem (at least, the problem described by the author looks very similar): apparently, rpy2 has to be recompiled and given the new version of R as an argument.

FYI: For Mac users: Following the link that @Bertrand Moreau shared, this worked on Mac OS X 10.7.5 and R 3.0.1:

cd /Users/xx/Downloads/rpy2-2.3.7
export LDFLAGS="-Wl,-rpath,/Library/Frameworks/R.framework/Resources/lib"
sudo python3.3 setup.py build --r-home /Library/Frameworks/R.framework/Resources install
sudo python3.3 setup.py install

I would have shared this as a comment to the above, but formatting was lost. SO newbie here!

I had a similar problem; I just uninstalled and then reinstalled rpy2 and it is working fine now.

A solution under ubuntu 14.04 using anaconda and python2.7 is the following:

conda install -c https://conda.anaconda.org/r rpy2

This works on the command line, and also from pycharm terminal for me. However, still does not work under pycharm, and I get the same error as OP.

The fact that it does now work on pycharm, but works on the pycharm terminal is a bit weird.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top