Unable to run the tests

Issue #117 resolved
Filipe Correia created an issue

I was following the instructions on the official docs on how o test an installation, and stumbled on this stack trace:

>>> import rpy2.tests
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.6/site-packages/rpy2/tests.py", line 9, in <module>
    import rpy2.robjects.tests
  File "/Library/Python/2.6/site-packages/rpy2/robjects/__init__.py", line 14, in <module>
    import rpy2.rinterface as rinterface
  File "/Library/Python/2.6/site-packages/rpy2/rinterface/__init__.py", line 3, in <module>
    if (sys.version_info.major == 2) and (sys.version_info.minor < 7):
AttributeError: 'tuple' object has no attribute 'major'

This is happening on MacOSX Snow Leopard, with (the default) python 2.6 and rpy '2.3.2'.

Comments (8)

  1. Filipe Correia reporter

    Seems to be an issue specific to 2.3.2. I've uninstalled and installed version 2.2.2, and all is working properly now.

  2. Laurent Gautier

    This is because the 2.3 series of rpy2 require Python 2.7, or 3.3 (Python 2.6 not supported). The irony is that the error occurs while testing the Python version.

    The 2.2 of rpy2 still supported Python 2.6.

    Others have advised against using the default Python from OS X (and from the time I used OS X, I'd back up the advice): install a recent Python and use that one with Rpy2.

  3. Filipe Correia reporter

    Ok, I see. So, my suggestion would be:

    • Make it clearer on the docs that rpy2>=2.3 requires python 2.7
    • Make the 2.3 series check for the python version, and warn the user if it's not 2.7. The current stack trace doesn't give any obvious clue about what might be the reason behind it...

    I plan the update to Mountain Lion very soon, but until I do, I guess I will have to stick with rpy2 2.2.

  4. Filipe Correia reporter

    The section http://rpy.sourceforge.net/rpy2/doc-2.3/html/overview.html#requirements in the documentation does tell about Python 2.7.

    Yeah, I know, but it doesn't say that it requires python 2.7. Not a big deal... but those stuck with python 2.6 might be encouraged by the "Python 2.6 might just work" part.

    There is a check about the Python version, but the check itself is unfortunately using a namedtuple not found in Python < 2.7.

    Ok. I guess there may be other ways to test for this that are backward compatible, but I'd have to look deeper into this in order to give a better suggestion.

    Using rpy2-2.2 is a choice you are making, not an obligation.

    Of course... :)

    To be clear, the suggestions I made are just that too, don't feel forced to implement them. They just reflect the pains I'm facing when setting up rpy2, which might or might not be felt by other users.

  5. Laurent Gautier

    Alright, alright... I'll put in bold that only Python 2.7 and Python 3.3 are supported. ;-)

    Thanks for the comments.

    Comments on issues is a terse form of communication and I am seeing now that there was room for possible misinterpretation.

    I agree that rpy2-2.3.x should nip in the bud attempts at even considering to use rpy2 with a non-supported version of Python. The multiple version compatibility is making it more annoying than it is worth for me (there were quite few reports about Python 2.6), but I'd gladly take patches.

    My other comment is that several people advice to not use OS X's system Python to install third-party modules, but rather use a self-installed Python (and this will lift the restriction to Python 2.6).

  6. Laurent Gautier

    More people tripped on the issue. I have to do something about it I guess... I am adding a warning message whenever an unsupported version of Python is used (will be included with release 2.3.3). It does not mean that it will run without glitch with Python 2.6, but at leas it won't crash when testing the Python version.

    Thanks for the report, I /did/ something about it in the end ;-)

  7. Log in to comment