virtualenv icon indicating copy to clipboard operation
virtualenv copied to clipboard

virtualenv silently ignores requested pip version if not available

Open ericriff opened this issue 1 year ago • 5 comments

Issue I'm trying to pin the version of pip my virtual envs will have, regardless of the version of virtualenv being used. I realized that if the requested pip version is not available then virtualenv just picks the latets, silently.

Check the following example where I request an older pip version, 20.0.1, but I end up with 22.3.1. On the other hand, if I request 20.0.2 it works as expected.

$ virtualenv /tmp/.venv --python 3.8 --verbose --pip==20.0.1           
find interpreter for spec PythonSpec(major=3, minor=8)
proposed PythonInfo(spec=CPython3.8.10.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]', encoding_fs_io=utf-8-utf-8)
create virtual environment via CPython3Posix(dest=/tmp/.venv, clear=False, global=False)
add seed packages via FromAppData(download=False, pip==20.0.1, setuptools=latest, wheel=latest, pkg_resources=latest, via=copy, app_data_dir=/home/eriff/.local/share/virtualenv/seed-app-data/v1.0.1.debian.1)
changing mode of /tmp/.venv/bin/wheel to 775
changing mode of /tmp/.venv/bin/wheel-3.8 to 775
changing mode of /tmp/.venv/bin/wheel3 to 775
changing mode of /tmp/.venv/bin/easy_install3 to 775
changing mode of /tmp/.venv/bin/easy_install to 775
changing mode of /tmp/.venv/bin/easy_install-3.8 to 775
add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh
created virtual environment CPython3.8.10.final.0-64 in 57ms
  creator CPython3Posix(dest=/tmp/.venv, clear=False, global=False)
  seeder FromAppData(download=False, pip==20.0.1, setuptools=latest, wheel=latest, pkg_resources=latest, via=copy, app_data_dir=/home/eriff/.local/share/virtualenv/seed-app-data/v1.0.1.debian.1)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator


$ source /tmp/.venv/bin/activate
$ pip --version
pip 22.3.1 from /home/eriff/.local/lib/python3.8/site-packages/pip (python 3.8)

Environment

Provide at least:

  • OS: Ubuntu 20.04
  • pip list of the host python where virtualenv is installed:
appdirs                 1.4.3
apturl                  0.5.2
attrs                   19.3.0
backcall                0.1.0
bcrypt                  3.1.7
bleach                  3.1.1
blinker                 1.4
bottle                  0.12.23
Brlapi                  0.7.0
certifi                 2019.11.28
chardet                 3.0.4
charset-normalizer      2.1.1
chrome-gnome-shell      0.0.0
Click                   7.0
cmake                   3.24.1.1
cmakelang               0.6.13
cmakelint               1.4.2
colorama                0.4.3
command-not-found       0.3
conan                   1.55.0
cppclean                0.13
cryptography            2.8
cupshelpers             1.0
dbus-python             1.2.16
decorator               4.4.2
deepdiff                6.2.3
defer                   1.0.6
defusedxml              0.6.0
distlib                 0.3.0
distro                  1.4.0
distro-info             0.23ubuntu1
duplicity               0.8.12.0
entrypoints             0.3
exceptiongroup          1.0.0
fasteners               0.14.1
filelock                3.0.12
fire                    0.3.1
future                  0.18.2
html5lib                1.0.1
httplib2                0.14.0
idna                    2.8
importlib-metadata      1.5.0
iniconfig               1.1.1
ipykernel               5.2.0
ipython                 7.13.0
ipython_genutils        0.2.0
ipywidgets              6.0.0
jedi                    0.15.2
Jinja2                  3.1.2
jsonschema              3.2.0
jupyter-client          6.1.2
jupyter-console         6.0.0
jupyter-core            4.6.3
keyring                 18.0.1
language-selector       0.1
launchpadlib            1.10.13
lazr.restfulclient      0.14.2
lazr.uri                1.0.3
lockfile                0.12.2
louis                   3.12.0
macaroonbakery          1.3.1
Mako                    1.1.0
MarkupSafe              2.1.1
meld                    3.20.2
mistune                 0.8.4
monotonic               1.5
more-itertools          4.2.0
nbconvert               5.6.1
nbformat                5.0.4
netifaces               0.10.4
ninja                   1.11.1
node-semver             0.6.1
notebook                6.0.3
numpy                   1.21.0
oauthlib                3.1.0
olefile                 0.46
ordered-set             4.1.0
orjson                  3.8.5
packaging               21.3
pandocfilters           1.4.2
paramiko                2.6.0
parso                   0.5.2
patch-ng                1.17.4
pdfcrowd                5.8.0
pexpect                 4.6.0
pickleshare             0.7.5
Pillow                  7.0.0
pip                     22.3.1
pluggy                  1.0.0
pluginbase              1.0.1
prometheus-client       0.7.1
prompt-toolkit          2.0.10
protobuf                3.6.1
pycairo                 1.16.2
pycups                  1.9.73
Pygments                2.3.1
PyGObject               3.36.0
PyJWT                   2.4.0
pymacaroons             0.13.0
PyNaCl                  1.3.0
pyparsing               3.0.9
pyRFC3339               1.1
pyrsistent              0.15.5
pytest                  7.2.0
python-apt              2.0.0+ubuntu0.20.4.8
python-dateutil         2.7.3
python-debian           0.1.36ubuntu1
pytz                    2019.3
pyxdg                   0.26
PyYAML                  5.3.1
pyzmq                   18.1.1
reportlab               3.5.34
requests                2.28.1
requests-unixsocket     0.2.0
screen-resolution-extra 0.0.0
SecretStorage           2.3.1
Send2Trash              1.5.0
setuptools              45.2.0
Shapely                 1.7.1
simplejson              3.16.0
six                     1.14.0
termcolor               2.1.0
terminado               0.8.2
testpath                0.4.4
tomli                   2.0.1
tornado                 5.1.1
tqdm                    4.64.1
traitlets               4.3.3
ubuntu-advantage-tools  27.12
ubuntu-drivers-common   0.0.0
ufw                     0.36
unattended-upgrades     0.1
urllib3                 1.26.12
usb-creator             0.3.7
virtualenv              20.0.17
wadllib                 1.3.3
wcwidth                 0.1.8
webencodings            0.5.1
wheel                   0.34.2
widgetsnbextension      2.0.0
xkit                    0.0.0
zipp                    1.0.0

Output of the virtual environment creation

Make sure to run the creation with -vvv --with-traceback:

virtualenv /tmp/.venv --python 3.8 --verbose --pip==20.0.1 --with-traceback
find interpreter for spec PythonSpec(major=3, minor=8)
proposed PythonInfo(spec=CPython3.8.10.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]', encoding_fs_io=utf-8-utf-8)
create virtual environment via CPython3Posix(dest=/tmp/.venv, clear=False, global=False)
add seed packages via FromAppData(download=False, pip==20.0.1, setuptools=latest, wheel=latest, pkg_resources=latest, via=copy, app_data_dir=/home/eriff/.local/share/virtualenv/seed-app-data/v1.0.1.debian.1)
changing mode of /tmp/.venv/bin/wheel-3.8 to 775
changing mode of /tmp/.venv/bin/wheel3 to 775
changing mode of /tmp/.venv/bin/wheel to 775
changing mode of /tmp/.venv/bin/easy_install to 775
changing mode of /tmp/.venv/bin/easy_install-3.8 to 775
changing mode of /tmp/.venv/bin/easy_install3 to 775
add activators for Bash, CShell, Fish, PowerShell, Python, Xonsh
created virtual environment CPython3.8.10.final.0-64 in 98ms
  creator CPython3Posix(dest=/tmp/.venv, clear=False, global=False)
  seeder FromAppData(download=False, pip==20.0.1, setuptools=latest, wheel=latest, pkg_resources=latest, via=copy, app_data_dir=/home/eriff/.local/share/virtualenv/seed-app-data/v1.0.1.debian.1)
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

ericriff avatar Jan 12 '23 20:01 ericriff