I keep getting a message to upgrade pip
Solution 1
The issue seems to be that new virtual environments are using an old version of pip. Note that pip is installed from a source tarfile (or wheel) included with virtualenv, in the site-packages/virtualenv_support
directory.
$ ls -l /path/to/site-packages/virtualenv_support
pip-9.1-py2.py3-none-any.whl
A quick way to workaround the problem is to make sure you upgrade pip whenever you create a new virtualenv, like so:
$ virtualenv venv
$ venv/bin/pip install -U pip
Alternatively, make sure you have the latest version of virtualenv. According to their release notes, virtualenv==16
is using pip==10
.
$ pip install -U virtualenv
Finally, since virtualenv looks for pip*.whl
in virtualenv_support
, this will also work:
$ mv /path/to/site-packages/virtualenv_support/pip*.whl{,bak}
$ pip wheel -w /path/to/site-packages/virtualenv_support/ 'pip==18'
All new virtualenvs will use the version of pip that you installed into virtualenv_support
. However, this feels hacky.
(Attempted with virtualenv==16
. This results in all new virtualenvs with pip==18.)
Solution 2
For me looks like you have multiple python environments and in one of them, there is not an upgraded pip. You have 2 options:
- navigate to each of that folders and update each pip
- you can remove all of them, reinstall and use virtualenv in future with correct pip
- install some IDE (e.g. PyCharm) that can handle that automatically for you and show all issues visually
Solution 3
Update pip from a bat file:
call .\venv\Scripts\activate
py -m pip install --upgrade pip
call deactivate
Or if you are in VS Code integrated Terminal
& venv/Scripts/activate.ps1
py -m pip install --upgrade pip
Related videos on Youtube
Maxim
Updated on August 17, 2020Comments
-
Maxim almost 4 years
Whenever I create a venv, I get a message asking me to upgrade pip. I run the command for upgrade, and it pops up again on another venv. How can I make this permanent.
Message:
You are using pip version 9.0.1, however version 18.0 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Update: Just received recommendation to read this possible duplicate answer: virtualenv use upgraded system default pip
This does not solve my issue though. Why?
My
pip3
appears to already be up to date:C:\Users\mkupfer\Python-Sandbox\sibc-python-scripts>pip --version pip 18.0 from c:\users\mkupfer\appdata\local\programs\python\python36-32\lib\sit e-packages\pip (python 3.6) C:\Users\mkupfer\Python-Sandbox\sibc-python-scripts>pip3 --version pip 18.0 from c:\users\mkupfer\appdata\local\programs\python\python36-32\lib\sit e-packages\pip (python 3.6) C:\Users\mkupfer\Python-Sandbox\sibc-python-scripts>pip3 install --upgrade pip Requirement already up-to-date: pip in c:\users\mkupfer\appdata\local\programs\p ython\python36-32\lib\site-packages (18.0)
Solved
Solution: I was able to fix this altogether by using
virtualenv
to create a new virtual environment. Not sure if this is a bug invenv
. I'll just use the package that works going forward. Thanks @James Lim for the answer.-
GetHacked almost 6 yearsWhere are you running the command to reinstall
pip
? And where is the message appearing?pip
may need to be updated in your venv, but you're trying to update in another enviornment -
Maxim almost 6 years@Dyno I guess there are two ways to answer that. 1. I ran on windows inside a cmd prompt. 2. Inside the venv after it has been activated.
-
Maxim almost 6 yearsThis message does not show up when I install outside of a venv.
-
phd almost 6 yearsPossible duplicate of virtualenv use upgraded system default pip
-
Evgeny almost 6 yearsI get this message all the time and cannnot upgrade, would be nice to see why and a solution.
-
georgexsh over 5 yearsyour virtualenv binary is likely belonged to another python installation, use
virtualenv -v venv
to check the detail. -
James Lim over 5 years@Maksim pretty certain that the issue here is that the version of pip packaged with virtualenv is outdated.
-
-
Maxim over 5 yearsBy multiple python environments are you talking about the virtual ones or the python installations themselves?
-
wowkin2 over 5 yearsBoth. Looks like you installed Python to some custom directory. I prefer to install it to a folder like: `C:\Python36`. So every time I see where all versions are and able to uninstall it. And preferable way is to use mostly python from virtualenv, not root.
-
wowkin2 over 5 years@Maksim, try to uninstall Python completely and install the newest version. After create new virtual environments for your projects.
-
Maxim over 5 yearsthat still didn't fix my problem. Unless I didn't uninstall correctly, but that was a bit confusing. I also don't want to use a large IDE, I'm fine with IDLE.
-
Maxim over 5 yearsThanks for your thorough reply. In regards to the commands you had me run everything points to my 3.6 version of python and doing
pip list
shows that my pip is 18.0. Seems like thevenv
command is using a different version. Is that possible? -
Maxim over 5 yearsAlso:
$ python -m pip install -U pip
just returnsRequirement already up-to-date: pip in c:\users\mkupfer\appdata\local\programs\p ython\python36-32\lib\site-packages (18.0)
-
Maxim over 5 yearsThis is not the type of solution I'm looking for. I would rather have things working correctly than to create a workaround script.
-
wowkin2 over 5 yearsHad you another version of Python on the same PC? For example 2.7?
-
Maxim over 5 yearsSo
virtualenv
was on version15.1.0
. I updated to16.0.0
but still having old version of pip.pip list
shows that I'm still onpip (9.0.1)
-
James Lim over 5 yearsDid you create new virtual environment, and verify that the version of pip, in that new virtual environment, is at 9.0.1? Is that is the case, then the release notes for virtualenv are wrong. Also, have you looked inside
virtualenv_support
? -
Maxim over 5 yearsI did notice that I have a
pipenv 9.0.3
. Does that need to be removed/updated? -
Maxim over 5 yearsyes I created a new venv --> activated it --> ran
pip list
-
James Lim over 5 yearsWhat command are you using to create the virtualenv? Make sure you run
virtualenv --version
, then runvirtualenv venv
. For now, don't usepipenv
, to simplify the problem. -
James Lim over 5 yearsLet us continue this discussion in chat.
-
Admin over 5 yearsWill this ever truly solve the problem? Won't OP just have to redo this step once
virtualenv
is updated or am I missing something? -
James Lim over 5 yearsIf you update
/path/to/site-packages/virtualenv_support/
, all new virtualenvs will use the new pip that you installed there. -
Admin over 4 years@Maksim apologies, I has assumed that you may have been creating a virtualenv from a script, and therefore may have had the luxury of adding a line or two of code.
-
above_c_level almost 4 yearsPlease don't repost answers. If an answer was helpful, please upvote the answer.
-
Ghasem Tabatabaei almost 3 yearsI used "pip install --upgrade pip" and it works....