Search code examples
pythonvirtualenvpippython-2.5

python2.5 packages in virtualenv contain too new syntax for python2.5


I've created a virtualenv that uses python2.5 instead of my default version python2.6 by executing this command:

virtualenv -p /usr/bin/python2.5 myvirtualenv --no-site-packages

Now, when I want to install packages in the virtualenv using pip, I get syntax errors like this one:

File "/home/philipp/.virtualenvs/myvirtualenv/lib/python2.5/site-packages/pip-1.4.1-py2.5.egg/pip/vendor/distlib/compat.py", line 276
    return b''
             ^
SyntaxError: invalid syntax

That means that my python2.5 packages contain syntax that is not yet valid in python2.5. When I use pip-2.5 this will not change anything. There should be two possibilities to get around this problem:

  1. Somehow tell pip that it should accept the newer syntax
  2. Find the misconfiguration of the virtualenv program and repair it.

I'm happy about any ideas about how to proceed.


Solution

  • Pip version 1.4 requires Python 2.6 or newer.

    You'll need to install Pip version 1.3.1 if you want it to work on Python 2.5, see Python & OS Support.