pyenv virtualenv installs outdated version of pip
MartinAltmayerTNG opened this issue · comments
On my machine, pyenv virtualenv always installs pip in version 19.2.3, which is too old for my purposes.
martin ~ » pyenv virtualenv 3.8.3 test
Looking in links: /tmp/tmpl49cyvq9
Requirement already satisfied: setuptools in /home/martin/.pyenv/versions/3.8.3/envs/test/lib/python3.8/site-packages (41.2.0)
Requirement already satisfied: pip in /home/martin/.pyenv/versions/3.8.3/envs/test/lib/python3.8/site-packages (19.2.3)
martin ~ » PYENV_VERSION=test pip --version
pip 19.2.3 from /home/martin/.pyenv/versions/3.8.3/envs/test/lib/python3.8/site-packages/pip (python 3.8)
I don't understand where this pip version comes from. Both system
and the base version 3.8.3
have newer versions of pip installed:
martin ~ » python --version
Python 3.9.6
martin ~ » pip --version
pip 20.3.4 from /usr/lib/python3.9/site-packages/pip (python 3.9)
martin ~ » PYENV_VERSION=system pip --version
pip 20.3.4 from /usr/lib/python3.9/site-packages/pip (python 3.9)
martin ~ » PYENV_VERSION=3.8.3 pip --version
pip 21.1.3 from /home/martin/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pip (python 3.8)
Is there some configuration or a cache that I am missing? Note that I cannot use PIP_VERSION
to specify a newer version, see #381.
What version of pip is pyenv-virtualenv supposed to install?
This may be related to pyenv/pyenv#1980 -- Virtualenv doesn't correctly determine when Pyenv-provided version is switched and provides a wrong cached result.
Try setting the VIRTUALENV_SEEDER
envvar to pip
-- this will hopefully bypass the broken caching logic.
I have just installed pyenv-virtualenvwrapper
with Homebrew and am also running into this issue (in particular; I have pip==22.3
but when I do mkvirtualenv, I get pip==22.2.3
).
The solution doesn't seem to do the trick:
~/Movies
❯ pip --version
pip 22.3 from /Users/dteiml/.pyenv/versions/3.8.12/lib/python3.8/site-packages/pip (python 3.8)
~/Movies
❯ export VIRTUALENV_SEEDER=pip
~/Movies
❯ mkvirtualenv test
created virtual environment CPython3.8.12.final.0-64 in 1956ms
creator CPython3Posix(dest=/Users/dteiml/.virtualenvs/test, clear=False, no_vcs_ignore=False, global=False)
seeder PipInvoke(download=False, pip=bundle, setuptools=bundle, wheel=bundle)
added seed packages: pip==22.2.2, setuptools==62.5.0, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
virtualenvwrapper.user_scripts creating /Users/dteiml/.virtualenvs/test/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/dteiml/.virtualenvs/test/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/dteiml/.virtualenvs/test/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/dteiml/.virtualenvs/test/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/dteiml/.virtualenvs/test/bin/get_env_details
pip --ver%
~/Movies via 🐍 v3.8.12 (test) took 4s
❯ pip --version
pip 22.2.2 from /Users/dteiml/.virtualenvs/test/lib/python3.8/site-packages/pip (python 3.8)
Is there any currently working solution to this? Why was this issue closed? @native-api
Okay, looking more closely:
martin ~ » pyenv virtualenv 3.8.3 test
Looking in links: /tmp/tmpl49cyvq9
Requirement already satisfied: setuptools in /home/martin/.pyenv/versions/3.8.3/envs/test/lib/python3.8/site-packages (41.2.0)
Requirement already satisfied: pip in /home/martin/.pyenv/versions/3.8.3/envs/test/lib/python3.8/site-packages (19.2.3)
martin ~ » PYENV_VERSION=test pip --version
pip 19.2.3 from /home/martin/.pyenv/versions/3.8.3/envs/test/lib/python3.8/site-packages/pip (python 3.8)
@MartinAltmayerTNG Seems that this Pip is taken from the base installation. So upgrade the Pip there.
Or the environment already exists and pyenv virtualenv 3.8.3 test
becomes a no-op.
❯ mkvirtualenv test
created virtual environment CPython3.8.12.final.0-64 in 1956ms
@hacker-DOM Since mkvirtualenv
comes from Homebrew, it probably uses Homebrew's Python as base rather than Pyenv-provided Python, and takes Pip from there. So this problem is not Pyenv-related.
I have the same issue.
I tried to set the PIP_VERSION
but ran into the "colorize command not found problem".
Then I set GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py
but this didn't help either.
Also tried export VIRTUALENV_SEEDER=pip
as you mentioned.
It's always installing an older pip version despite having:
pip 22.3.1 from /Users/heinzi/.pyenv/versions/3.9.0/lib/python3.9/site-packages/pip (python 3.9)
Any other ideas @native-api and thanks for your work!
@moneymanolis Please export PYENV_DEBUG=1
, run the faulty command to demonstrate the issue and attach the resulting debug trace as a gist.
Will do!