omribahumi
omribahumi

Reputation: 2131

Any trick to make get-pip.py install a specific pip version?

PIP was recently (yesterday) upgraded from 1.5.6 to 6.0.1. It broke a couple of my stuff. I'm looking for a way to make the "get-pip.py" script install 1.5.6 instead of the latest version.

Any ideas?

Upvotes: 7

Views: 6970

Answers (3)

MPlanchard
MPlanchard

Reputation: 1948

This is a relatively old question, but I discovered today that recent versions of get-pip.py allow you to pass in an argument such as pip<6 to ensure that the pip version installed is < 6:

[Nautilus@Nautilus scripts]$ python get-pip.py "pip<6"
Collecting pip<6
  Downloading pip-1.5.6-py2.py3-none-any.whl (1.0MB)
    100% |████████████████████████████████| 1.0MB 608kB/s 
Installing collected packages: pip
Successfully installed pip-1.5.6

This seems to work with any argument form you could pass to pip itself, e.g. >, <, <=, >=, and ==

Upvotes: 17

cel
cel

Reputation: 31349

As I tried to explain in the comments, get-pip.py in meant to be a bootstrapping method for pip. The problem it aims to solve is that you need pip to install pip.

The script does not allow the user to choose which version of pip you will get, it automatically downloads the latest version.

You can adapt the script and change

def bootstrap(tmpdir=None):
    # Import pip so we can use it to install pip and maybe setuptools too
    import pip

    # We always want to install pip
    packages = ["pip"]

to

def bootstrap(tmpdir=None):
    # Import pip so we can use it to install pip and maybe setuptools too
    import pip

    # We always want to install pip
    packages = ["pip==1.5.6"]

Now the script should always install pip-1.5.6 instead of the latest version found on pypi.

Upvotes: 5

Reut Sharabani
Reut Sharabani

Reputation: 31339

I'm not sure how you're running your script, but you should be able to pull off something like:

python get-pip.py && pip install -I pip==1.5.6

You may need to prepend sudo to both commands.

https://pip.pypa.io/en/latest/reference/pip_install.html#cmdoption-I

Upvotes: 4

Related Questions