This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ensurepip upgrade fails
Type: Stage: resolved
Components: Windows Versions: Python 3.9
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: baterflyrity, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2021-09-09 07:09 by baterflyrity, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (8)
msg401436 - (view) Author: baterflyrity (baterflyrity) Date: 2021-09-09 07:09
Upgrading pip via ensurepip unfortunately doesn't do anything wealthy.

```bash
user@host MINGW64 ~
$ pip list | grep pip
pip                       21.2.3
WARNING: You are using pip version 21.2.3; however, version 21.2.4 is available.
You should consider upgrading via the 'C:\Python39\python.exe -m pip install --upgrade pip' command.

user@host MINGW64 ~
$ py -m ensurepip --upgrade
Looking in links: c:\Users\BATERF~1\AppData\Local\Temp\tmpuv4go5fy
Requirement already satisfied: setuptools in c:\python39\lib\site-packages (57.4.0)
Requirement already satisfied: pip in c:\python39\lib\site-packages (21.2.3)

user@host MINGW64 ~
$ pip list | grep pip
pip                       21.2.3
WARNING: You are using pip version 21.2.3; however, version 21.2.4 is available.
You should consider upgrading via the 'C:\Python39\python.exe -m pip install --upgrade pip' command.
```
msg401437 - (view) Author: baterflyrity (baterflyrity) Date: 2021-09-09 07:10
See also: https://github.com/pypa/pip/issues/10453
msg401438 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2021-09-09 07:23
From the documentation:

> upgrade indicates whether or not to upgrade an existing installation of an earlier version of pip to the bundled version.

Note the comment "to the bundled version". This command will not access the internet (also noted in the documentation) and so will not get a later version than the bundled one.

To get the latest version of pip, you need to use

    /path/to/your/python -m pip install --upgrade pip

Note:

1. You must *not* use the pip executable, you must use `python -m pip`, as the command will be upgrading the pip executable and Windows won't let you upgrade an executable you are using.
2. You should use the full path to your Python, or ensure by other means that you are running the correct copy of Python. This command only upgrades the copy of pip associated with the Python interpreter you use to run the upgrade command.
msg401442 - (view) Author: baterflyrity (baterflyrity) Date: 2021-09-09 07:52
> Note the comment "to the bundled version".

Thanks. Have not knew.

> 1. You must *not* use the pip executable, you must use `python -m pip`, as the command will be upgrading the pip executable and Windows won't let you upgrade an executable you are using.

You are wrong. Windows lets me update pip via pip.

Also must notice that ensurepip also deletes the current pip before installing it's own. So in case of "Permission denied" error it just deletes pip (see https://github.com/pypa/pip/issues/9527). Should i create new issue for this?
msg401443 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2021-09-09 08:01
> You are wrong. Windows lets me update pip via pip.

You have misinterpreted what you are seeing.

> Should i create new issue for this?

No, you should follow the correct process and use `python -m pip`, and not use pip directly.
msg401447 - (view) Author: baterflyrity (baterflyrity) Date: 2021-09-09 09:01
>> You are wrong. Windows lets me update pip via pip.
>
>You have misinterpreted what you are seeing.

I don't know technical details but i can successfully use this command: `pip install --upgrade pip`.

>No, you should follow the correct process and use `python -m pip`, and not use pip directly.

On pip's issues tracker i was suggested to use `ensurepip --upgrade`. Therefore it deletes global system's pip when is ran without sudo or admin rights (when the current version of pip is lower then bundled).
msg401451 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2021-09-09 09:28
> I don't know technical details but i can successfully use this command: `pip install --upgrade pip`.

On Windows (and not under something like cygwin or msys, which have their own rules)? Anyway, it's not that important, the recommended approach is `python -m pip`, so whether using the non-recommended approach works or not doesn't really matter.

> On pip's issues tracker i was suggested to use `ensurepip --upgrade`.

Let's take that question back to the pip tracker. If you want the latest version of pip (as opposed to the bundled version) ensurepip isn't the right approach.
msg401453 - (view) Author: baterflyrity (baterflyrity) Date: 2021-09-09 09:45
OK, ive caught the salt of ensurepip.
History
Date User Action Args
2022-04-11 14:59:49adminsetgithub: 89311
2021-09-09 09:45:35baterflyritysetmessages: + msg401453
2021-09-09 09:28:52paul.mooresetmessages: + msg401451
2021-09-09 09:01:06baterflyritysetmessages: + msg401447
2021-09-09 08:01:06paul.mooresetmessages: + msg401443
2021-09-09 07:52:25baterflyritysetmessages: + msg401442
2021-09-09 07:24:11paul.mooresetstatus: open -> closed
resolution: not a bug
stage: resolved
2021-09-09 07:23:49paul.mooresetmessages: + msg401438
2021-09-09 07:10:36baterflyritysetmessages: + msg401437
2021-09-09 07:09:50baterflyritycreate