asdf-community / asdf-python

Python plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
643 stars 55 forks source link

Add envvar to allow upgrading pip before installing default-python-packages #179

Open dadastoor opened 6 months ago

dadastoor commented 6 months ago

Feature

Upgrade pip before running pip install for default-python-packages

$ cat ~/.default-python-packages
ansible

Problem:

$ asdf install python 3.6.15
# ...
# Python 3.6.15 install goes here
# ...
# some other pip packages collected first
# ...
Collecting ansible-core~=2.16.0 (from ansible->-r /home/ddastoor/.default-python-packages (line 4))
Could not find a version that satisfies the requirement ansible-core~=2.16.0 (from ansible->-r /home/ddastoor/.default-python-packages (line 4)) (from versions: 0.0.1a1, 2.11.0b1, 2.11.0b2, 2.11.0b3, 2.11.0b4, 2.11.0rc1, 2.11.0rc2, 2.11.0, 2.11.1rc1, 2.11.1, 2.11.2rc1, 2.11.2, 2.11.3rc1, 2.11.3, 2.11.4rc1, 2.11.4, 2.11.5rc1, 2.11.5, 2.11.6rc1, 2.11.6, 2.11.7rc1, 2.11.7, 2.11.8rc1, 2.11.8, 2.11.9rc1, 2.11.9, 2.11.10rc1, 2.11.10, 2.11.11rc1, 2.11.11, 2.11.12rc1, 2.11.12)
No matching distribution found for ansible-core~=2.16.0 (from ansible->-r /home/ddastoor/.default-python-packages (line 4))
You are using pip version 18.1, however version 21.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Solution:

$ asdf install python 3.6.15
# ...
# Python 3.6.15 install goes here
# ...
Installed Python-3.6.15 to /home/ddastoor/.asdf/installs/python/3.6.15
pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3.1-py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 18.1
Uninstalling pip-18.1:
Successfully uninstalled pip-18.1
Successfully installed pip-21.3.1
# ...
# some other pip packages collected first
# ...
Collecting ansible-core~=2.11.7
Using cached ansible-core-2.11.12.tar.gz (7.1 MB)
Preparing metadata (setup.py) ... done