Title: ensurepip warning about running pip as the root user cannot be suppressed · Issue #139363 · python/cpython · GitHub
Open Graph Title: ensurepip warning about running pip as the root user cannot be suppressed · Issue #139363 · python/cpython
X Title: ensurepip warning about running pip as the root user cannot be suppressed · Issue #139363 · python/cpython
Description: Bug report Bug description: The Github Action for installing python currently invokes ensurepip before installing pip. This all works great. It even sets PIP_ROOT_USER_ACTION=ignore to suppress the warning about root (text below), which ...
Open Graph Description: Bug report Bug description: The Github Action for installing python currently invokes ensurepip before installing pip. This all works great. It even sets PIP_ROOT_USER_ACTION=ignore to suppress the...
X Description: Bug report Bug description: The Github Action for installing python currently invokes ensurepip before installing pip. This all works great. It even sets PIP_ROOT_USER_ACTION=ignore to suppress the...
Opengraph URL: https://github.com/python/cpython/issues/139363
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ensurepip warning about running pip as the root user cannot be suppressed","articleBody":"# Bug report\n\n### Bug description:\n\nThe [Github Action for installing python](https://github.com/actions/python-versions/blob/main/installers/nix-setup-template.sh#L53) currently invokes `ensurepip` before installing pip. This all works great. It even sets `PIP_ROOT_USER_ACTION=ignore` to suppress the warning about root (text below), which is common when using containerized environments in CI. However it seems that `pip` respects this environment variable while `ensurepip` does not. In particular, https://github.com/python/cpython/blob/main/Lib/ensurepip/__init__.py#L101 seems to guarantee that `ensurepip` will honor neither environment variables nor the pip configuration file for controlling this.\n\nI have a few questions about this and didn't see a prior ticket, so here goes:\n\n* Is the Github action taking the correct approach to install Python? (AFAICT, yes)\n* Is `ensurepip` ignoring all environment and configuration correct? AFAICT this was added a long time ago to address some test suite issues\n* Is there any way I have missed to suppress the below message when the installer invokes `ensurepip` within a container running as root? ```WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv```\n* If there is no way, should there be? IMO, yes. My proposal would be to alter the sanitization to preserve this variable. I'm happy to PR that if it is the best approach here.\n\n\n\n\n### CPython versions tested on:\n\n3.13\n\n### Operating systems tested on:\n\nLinux","author":{"url":"https://github.com/zvickery","@type":"Person","name":"zvickery"},"datePublished":"2025-09-26T15:05:10Z","url":"https://github.com/python/cpython/issues/139363"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:52442453-93fc-5627-036c-f7fd7f131b40 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BD30:2536B8:7DB838:A5FBBF:6AF84700 |
| html-safe-nonce | cf02f2a8196d8884876ed4f475171a9e63e6e4daf8087a54f7775d390b475f4b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDMwOjI1MzZCODo3REI4Mzg6QTVGQkJGOjZBRjg0NzAwIiwidmlzaXRvcl9pZCI6IjY3ODQ2NDA5NzA3NDMwMDY3MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0226101b67af768ace73be768acbef1971bac520583df7ae45f1a484adea4b24 |
| hovercard-subject-tag | issue:3458025304 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/139363/issue_layout |
| twitter:image | https://opengraph.githubassets.com/846bf0cd15ee85206c604518ccb58902548da697047d41a18456e0f7699dedec/python/cpython/issues/139363 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/846bf0cd15ee85206c604518ccb58902548da697047d41a18456e0f7699dedec/python/cpython/issues/139363 |
| og:image:alt | Bug report Bug description: The Github Action for installing python currently invokes ensurepip before installing pip. This all works great. It even sets PIP_ROOT_USER_ACTION=ignore to suppress the... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zvickery |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5713ecd83001b2f55c3509fb7a292bf7d66d0f167c7ae87a9f7eaec5a52bf8db |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 653be32ff5c755082a4db662491bfbbcfc9112c1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width