[Distutils] using pip to install an specific, older version

Carl Meyer carl at oddbird.net
Mon Apr 2 21:08:30 CEST 2012


Hi Chris,

On 04/02/2012 12:50 PM, Chris Jerdonek wrote:
> Hi, I'm trying to use pip to install an older, specific version of a
> package in PyPI (specifically simplejson v2.0.9):
> 
> http://pypi.python.org/pypi/simplejson/2.0.9
> 
> I've tried a few variations of the syntax below, but it always seems
> to install the newest version (v2.5.0).  I don't know if this is an
> issue with simplejson, how I'm using pip, or something else.  Based on
> the below, can anyone say why it's not working and how to correct the
> behavior?
> 
> Thanks,
> --Chris
> 
> 
>> sudo pip freeze -E /opt/local/bin/python
> nose==1.1.2
>> sudo pip install -E /opt/local/bin/python 'simplejson<2.1.0'
> Downloading/unpacking simplejson<2.1.0
>   Running setup.py egg_info for package simplejson
> Installing collected packages: simplejson
>   Running setup.py install for simplejson
>       File "/opt/local/lib/python2.4/site-packages/simplejson/encoder.py",
> line 398
>         if (not _bigint_as_string or
>          ^
>     SyntaxError: invalid syntax
> Successfully installed simplejson
> Cleaning up...
>> sudo pip freeze -E /opt/local/bin/python
> nose==1.1.2
> simplejson==2.5.0
>> python -V
> Python 2.4.6
>> which python
> /opt/local/bin/python
>> which pip
> /usr/local/bin/pip

I can't replicate this; when I "pip install 'simplejson<2.1.0'" I get
2.0.9. The most likely cause is if you have a build/ directory in your
current working dir with an already-unpacked simplejson 2.5.0 in it;
there's a known bug in pip that causes it to not check the version if it
finds an already-unpacked source.

Also, you may want to be aware that the -E flag is deprecated and is
already removed in the latest pip release (1.1) because it does not
handle isolated virtualenvs correctly. Instead, create a virtualenv and
use the pip that is automatically installed inside it (virtualenv
path/to/venv && path/to/venv/bin/pip install simplejson).

Carl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20120402/16df696d/attachment.pgp>


More information about the Distutils-SIG mailing list