Quantcast

using pip to install an specific, older version

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

using pip to install an specific, older version

Chris Jerdonek-3
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
_______________________________________________
Distutils-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/distutils-sig
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: using pip to install an specific, older version

Carl Meyer-4
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


_______________________________________________
Distutils-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/distutils-sig

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: using pip to install an specific, older version

Chris Jerdonek-3
On Mon, Apr 2, 2012 at 12:08 PM, Carl Meyer <[hidden email]> wrote:

> 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.

Thanks, Carl.  Good intuition!  That was the case for me.  Thanks also
for the information regarding -E and virtualenv.  I will start using
that approach.

--Chris

>
> 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
>
>
> _______________________________________________
> Distutils-SIG maillist  -  [hidden email]
> http://mail.python.org/mailman/listinfo/distutils-sig
>
_______________________________________________
Distutils-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/distutils-sig
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: using pip to install an specific, older version

Chris Jerdonek-3
In reply to this post by Carl Meyer-4
Hi Carl (or others),

On Mon, Apr 2, 2012 at 12:08 PM, Carl Meyer <[hidden email]> wrote:
>
> 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).

With regard to the above, if the recommended way to use pip is to use
it after calling virtualenv, then what is the recommended way to
invoke/install virtualenv for use from a global Python (e.g. from a
Python 3.2 installed via MacPorts).  Before, I would have installed
virtualenv by invoking pip with the -E flag.  But by the above that
approach is deprecated.

Also, does it matter whether virtualenv is run from Python 2 or Python
3?  In particular, can virtualenv run from both Python 2.x and Python
3.x create virtual environments based on both Python 2.x and Python
3.x?

Thanks,
--Chris
_______________________________________________
Distutils-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/distutils-sig
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: using pip to install an specific, older version

Carl Meyer-4
Hi Chris,

On 04/04/2012 02:10 PM, Chris Jerdonek wrote:

> On Mon, Apr 2, 2012 at 12:08 PM, Carl Meyer <[hidden email]> wrote:
>> 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).
>
> With regard to the above, if the recommended way to use pip is to use
> it after calling virtualenv, then what is the recommended way to
> invoke/install virtualenv for use from a global Python (e.g. from a
> Python 3.2 installed via MacPorts).  Before, I would have installed
> virtualenv by invoking pip with the -E flag.  But by the above that
> approach is deprecated.
You can just "pip install virtualenv" (or easy_install virtualenv) into
your Python 3.2 install, which will make the "virtualenv" script
available. Or you can just download the virtualenv.py file from GitHub,
and run it via "python virtualenv.py" - it runs fine standalone.

> Also, does it matter whether virtualenv is run from Python 2 or Python
> 3?  In particular, can virtualenv run from both Python 2.x and Python
> 3.x create virtual environments based on both Python 2.x and Python
> 3.x?

You can run virtualenv under either 2.x or 3.x, and create virtualenvs
for any Python version by using the --python flag to point to the Python
binary you want the new virtualenv to use. So you only need one
installation/copy of virtualenv on your system.

Carl


_______________________________________________
Distutils-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/distutils-sig

signature.asc (205 bytes) Download Attachment
Loading...