unable to upgrade the pip version

Answered

Hi, 

I'm new to pycharm and i'm trying to install some packages for some scripts but I can't seem to upgrade the terminal version of pip. 

My system version of pip is 18.0 and has been for a while but the default version in pycharm is 10.0.1 and when i try to install a package in the terminal it warns me of my outdated pip. 


e.g.
C:\Users\Me\PycharmProjects\VBAProject>pip install package
...
    You are using pip version 10.0.1, however version 18.0 is available.
    You should consider upgrading via the 'python -m pip install --upgrade pip' command.

but when i try to upgrade pip it says that it is upgraded. 

    (venv) C:\Users\Me\PycharmProjects\VBAProject>python -m pip install --upgrade pip
    Requirement already up-to-date: pip in c:\users\Me\pycharmprojects\vbaproject\venv\lib\site-packages (18.0)

but when i check it, there are two distinct versions of pip. 
    (venv) C:\Users\Me\PycharmProjects\VBAProject>pip --version
    pip 10.0.1 from c:\users\Me\pycharmprojects\vbaproject\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip (python 3.7)

    (venv) C:\Users\Me\PycharmProjects\VBAProject>python -m pip --version
    pip 18.0 from C:\Users\Me\PycharmProjects\VBAProject\venv\lib\site-packages\pip (python 3.7)

I have checked Settings > Project interpreter and it says 18 as well. 
I have also checked the command prompt version of pip and it is 18 

I can't figure out how to update it. Am I doing something wrong?

Is there a way to change the default version of pip that is installed in new projects so that i don't have to worry about this or does it always install pip 10 by default?

System - Windows 7 -64bit
Python - 3.7-64
Pycharm - community edition 2018.2 64 bit

Cheers.

16 comments
Comment actions Permalink

Try reinstalling using curl and the path to wichever pip you are trying to upgrade

curl https://bootstrap.pypa.io/get-pip.py | c:\users\Me\pycharmprojects\vbaproject\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip (python 3.7)

 

Cheers

0
Comment actions Permalink

EDIT:

I have changed 10.0.1 to 18.0 in 'C:\Folder\To\Project\venv\Scripts' in the files called pip-script.py, pip3-script.py, and pip3.6-script.py. This seems to now have the right version,

------ ORIGINAL MESSAGE BELOW -----

I have this exact same problem.

In pycharm, everytime I go to the terminal window, and maybe type "pip search <package>" I keep getting told I'm using version 10.0.1.

the annoying thing is I've run 'python -m pip install --upgrade pip". and in File -> Settings -> Project:projectName -> Project Inspector it shows I have version 18 installed for this virtual environment.

The rest of my system uses the latest version of Pip, it's only when I create new projects+venv in pyCharm that this problem arises.

0
Comment actions Permalink

I have the same issue - can't figure out where PyCharm gets this version, but every time I have PyCharm create the new venv, it comes with an old version of pip (10.0.1). This is in spite of pip having been upgrades for all versions of Python I'm aware of on my system, pip caches having been cleared and PyCharm being fully up to date.

If anyone has a clue, I'd love to hear it.

0
Comment actions Permalink

Hi,

PyCharm has its own bundled pip. But as far as I know we are going to update it in a future release.

Kind regards,

Sergey

0
Comment actions Permalink

Ah, that kind of makes sense then. Not sure I understand the why, but I can imagine a few reasons. Hope to see the update come through soon. Thanks for providing the unambiguous feedback.

I love how convenient PyCharm makes starting a new project and a matching venv, but it'd be even nicer if it picked up the tools and packages from a Python version I select to base it off of. I'd be absolutely OK with that not being the default setting, but it'd be an option I'd try.

Is this worth submitting as a feature request somewhere? Or does it stand about as much of a chance as a snowball in hell?

0
Comment actions Permalink

There is already such feature. When you create a new virtual environment there is a checkbox "Inherit global site-packages".

Or do I miss something?

 

0
Comment actions Permalink

try:
python -m pip install -U --force-reinstall pip
inside your venv

https://github.com/pypa/pip/issues/5820#issuecomment-428611054

4
Comment actions Permalink

Using 'Inherit global site-packages' works around the issue in that it doesn't provide a new copy of pip and thus the globally available pip is used.

However, if I base a new virtualenv off of another version of Python that is installed on my system, this creates a problem: the version of pip doesn't match the version of Python I am using.

For example, I have Python 2.7.14, 3.6.6 and 3.7.0 currently installed - all with an up to date of their relevant pip copy. 3.7 is the default and on the path. If I create a new virtual environment using PyCharm and base it on the 3.6 version (with 'Inherit global site-packages'), I get a new environment that has the 3.6 interpreter, but running pip will still execute the globally available one for 3.7.

So, it is currently not a solution for my issue.

I tried @smailzhu's suggestion, and that fixes the problem, although I still think PyCharm should create a copy of the pip for the Base interpreter instead of its own aged copy. Note: only if run directly from the Scripts folder inside the venv, just activating the venv is not enough, the command has to be issued with the Scripts directory as the working directory.

0
Comment actions Permalink

Please feel free to submit a feature request about it to our issue tracker using the link https://youtrack.jetbrains.com/issues/PY and let us know if you need any help.

0
Comment actions Permalink

Nothing seems to work for me either.  I have upgraded both PIP and SetupTools in two different locations that I thought PyCharm is using to create new venvs.  The upgrades via command line were successful.  I can see them under Project Interpreters area of the Settings screen.  I can select both flavors and see that they are updated too.   For some reason the new project was created with the outdated packages after trying all of those steps.   This shouldn't be that hard to solve.

0
Comment actions Permalink

As stated in the comments above, PyCharm uses it's own bundled pip, so upgrading the pip from outside of PyCharm and then creating a new project might not have an effect. 

Have you tried to open terminal inside your project in PyCharm (the terminal prompt should display the name of your activated venv) and executing there:

python -m pip install -U --force-reinstall pip

...?

3
Comment actions Permalink

Thanks, Andrey. --force-reinstall works for me.

0
Comment actions Permalink

python -m pip install -U --force-reinstall pip

0
Comment actions Permalink

thank you andrey resler

 

0
Comment actions Permalink

I had this problem today (14/3/2019).

smailzhu's suggestion:

python.exe -m pip install -U --force-reinstall pip

worked for me.

0
Comment actions Permalink

This command does work but it only upgrades the current virtual environment.  

 

python.exe -m pip install -U --force-reinstall pip

 

It appears that the version of PIP used when creating new virtual environments is an older version.   It appears that this is a known "feature" of PyCharm and that a future release at some point will address this and a new PIP will be available for new venvs moving forward.   Right now it appears that you must update PIP and SetupTools for each new venv/project you create at this time.

 

0

Please sign in to leave a comment.