1
votes

I am using Anaconda on Ubuntu 20.04. I have installed rpy2 with conda install rpy2 in a virtual enviroment (different from base) When I want to run from rpy2.rinterface import RRuntimeError I get the next error:

from rpy2.rinterface import RRuntimeError 

ImportError: cannot import name 'RRuntimeError' from 'rpy2.rinterface' (/home/myuser/anaconda3/envs/myenvorment/lib/python3.7/site-packages/rpy2/rinterface.py)

1
can you add the output of conda list -n myenvorment rpy2? - cel

1 Answers

1
votes

You seem to use the new rpy2 version (3.x) in which RRuntimeError has moved from rpy2.rinterface to rpy2.rinterface_lib.embedded. Instead, use:

from rpy2.rinterface_lib.embedded import RRuntimeError

See an example in the latest rpy2 documentation and the 3.0 changelog which explains that rpy2.rinterface was completely rewritten for 3.x version.