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.

Title: ensurepip uses cache directory
Type: behavior Stage: resolved
Components: Build, Installation Versions: Python 3.10, Python 3.9, Python 3.8, Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Marcus.Smith, dstufft, kkonopko, miss-islington, ncoghlan, ned.deily, paul.moore, pradyunsg
Priority: normal Keywords: patch

Created on 2020-04-30 09:39 by kkonopko, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19812 merged kkonopko, 2020-04-30 09:49
PR 20893 merged miss-islington, 2020-06-15 17:29
PR 20894 merged miss-islington, 2020-06-15 17:29
PR 20895 merged miss-islington, 2020-06-15 17:29
Messages (7)
msg367751 - (view) Author: Krzysztof Konopko (kkonopko) * Date: 2020-04-30 09:39
ensurepip optionally installs or upgrades 'pip' and 'setuptools' using the version of those modules bundled with Python.  The internal PIP
installation routine by default temporarily uses its cache, if it
exists.  This is undesirable as Python builds and installations may be
independent of the user running the build, whilst PIP cache location
is dependent on the user's environment and outside of the build

At the same time, there's no value in using the cache while installing
bundled modules.  By design ensurepip does not access network so there's no point in checking or in any way accessing the cache.

This causes a problem in somewhat less usual build environments where Python is built into a designated `DESTDIR` with `--prefix` specified etc. If it does not have write permission to the cache directory (eg. `$HOME/.cache/pip` on Linux), it issues a warning but it installs bundled 'pip' and 'setuptools' fine.  But if it does not have execute access (to read directories), it fails hard.

`strace` also shows a lot of checks and even temporary use of the cache directory while processing whl files.
msg369436 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-05-20 09:53
Thanks for the PR. We should get a review from at least one of the pip developers. @oradyunsg, @dstufft, @paul.moore, opinions?
msg369437 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2020-05-20 10:12
PR looks good to me. There's a test failure that needs fixing and the PR needs a news entry, but otherwise looks fine.
msg371579 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2020-06-15 17:28
New changeset 4a3a682b12f93a03888e8b59f439bc5fe30d6055 by Krzysztof Konopko in branch 'master':
bpo-40448: ensurepip: Do not use cache (GH-19812)
msg371580 - (view) Author: miss-islington (miss-islington) Date: 2020-06-15 17:44
New changeset b46beb25e4cf213dbf46a0a0cf3f0ed134894f7d by Miss Islington (bot) in branch '3.7':
bpo-40448: ensurepip: Do not use cache (GH-19812)
msg371581 - (view) Author: miss-islington (miss-islington) Date: 2020-06-15 17:45
New changeset a1d3be4623c8ec7069bd34ccdce336be9cdeb644 by Miss Islington (bot) in branch '3.8':
bpo-40448: ensurepip: Do not use cache (GH-19812)
msg371582 - (view) Author: miss-islington (miss-islington) Date: 2020-06-15 17:48
New changeset 9a0624a3d9feb0c7664ace7a894a04e4af547661 by Miss Islington (bot) in branch '3.9':
bpo-40448: ensurepip: Do not use cache (GH-19812)
Date User Action Args
2022-04-11 14:59:30adminsetgithub: 84628
2020-06-15 19:24:55ned.deilysetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.7, Python 3.8
2020-06-15 17:48:50miss-islingtonsetmessages: + msg371582
2020-06-15 17:45:25miss-islingtonsetmessages: + msg371581
2020-06-15 17:44:40miss-islingtonsetmessages: + msg371580
2020-06-15 17:29:22miss-islingtonsetpull_requests: + pull_request20078
2020-06-15 17:29:13miss-islingtonsetpull_requests: + pull_request20077
2020-06-15 17:29:06miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request20076
2020-06-15 17:28:55ned.deilysetmessages: + msg371579
2020-05-20 10:12:40paul.mooresetmessages: + msg369437
2020-05-20 09:53:13ned.deilysetnosy: + ned.deily, Marcus.Smith, paul.moore

messages: + msg369436
versions: + Python 3.10
2020-04-30 22:40:05ned.deilysetnosy: + ncoghlan, dstufft, pradyunsg
2020-04-30 09:49:17kkonopkosetkeywords: + patch
stage: patch review
pull_requests: + pull_request19132
2020-04-30 09:39:11kkonopkocreate