1

I'm trying to import the rpy1.0.3 module for python2.6.6 using:

from rpy import *

and getting this error:

File "C:\Python26\lib\site-packages\rpy.py", line 58, in <module>
    RVERSION = rpy_tools.get_R_VERSION(RHOME)
  File "C:\Python26\lib\site-packages\rpy_tools.py", line 103, in get_R_VERSION
    raise RuntimeError("Couldn't obtain version number from output\n"
RuntimeError: Couldn't obtain version number from output
of `R --version'.

As stated in the rpy documentation I've set up an environmental variable with the file path to my R directory, but it doesnt seem to be able to recognize the version of R (I have 2.9.0 installed). Any thoughts? Thanks

1
  • What happens if you run R --version from the command line? Commented May 5, 2011 at 1:46

1 Answer 1

1

The setup.py script is calling upon the rpy_tools.py script to gain access to the version number. It searches the output of R --version for a regular expression:

version = re.search(" +([0-9]\.[0-9]\.[0-9])", output)

However, R is now in version 2.13.0, so it won't be able to find a two-digit version number. Replace that line in rpy_tools.py with:

version = re.search(" +([0-9]+\.[0-9]+\.[0-9]+)", output)

You will also need to delete the rpy_tools.pyc file that is created by setup.py

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.