Title: pip is broken after downgrade on Windows pypy-3.11 · Issue #1348 · actions/setup-python · GitHub
Open Graph Title: pip is broken after downgrade on Windows pypy-3.11 · Issue #1348 · actions/setup-python
X Title: pip is broken after downgrade on Windows pypy-3.11 · Issue #1348 · actions/setup-python
Description: Description: When using the setup-python action with pypy-3.11 on Windows, installing a version of pip older than the version pre-installed by setup-python results in a completely broken pip. Here is an example workflow run that demonstr...
Open Graph Description: Description: When using the setup-python action with pypy-3.11 on Windows, installing a version of pip older than the version pre-installed by setup-python results in a completely broken pip. Here ...
X Description: Description: When using the setup-python action with pypy-3.11 on Windows, installing a version of pip older than the version pre-installed by setup-python results in a completely broken pip. Here ...
Opengraph URL: https://github.com/actions/setup-python/issues/1348
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"pip is broken after downgrade on Windows pypy-3.11","articleBody":"**Description:**\nWhen using the `setup-python` action with `pypy-3.11` on Windows, installing a version of `pip` older than the version pre-installed by `setup-python` results in a completely broken `pip`. \n\nHere is an example workflow run that demonstrates the issue:\nhttps://github.com/bashonly/setup-python-pypy-pip-bug/actions/runs/30870303776\n\n**Action version:**\nreproducible on `v7.0.0`, `v6.3.0`, `v6.2.0`, possibly older versions\n\n**Platform:**\n- [x] Windows\n\n(not reproducible on Ubuntu)\n\n**Runner type:**\n- [x] Hosted\n\n**Tools version:**\npypy-3.11\n\n**Repro steps:** \n1. Create a GHA workflow with a job that runs on `windows-latest`\n2. Add a step that uses `actions/setup-python` with `python-version: pypy-3.11`\n3. Add a step that downgrades pip, e.g. `python -m pip install \"pip==26.1.2\"`\n4. Add a step that attempts to use the downgraded pip, e.g. `python -m pip install requests`\n5. Run the workflow\n\nHere is a reproducer workflow:\n\nhttps://github.com/bashonly/setup-python-pypy-pip-bug/blob/47691675557d9cc18be1716fbdc2ba690852b9c3/.github/workflows/demo.yml\n\n\u003cdetails>\u003csummary>demo.yml\u003c/summary>\n\n```yaml\nname: PyPy pip bug MRE\non:\n workflow_dispatch:\n\npermissions:\n contents: read\n\njobs:\n demonstrate:\n name: Demonstrate PyPy pip issue\n permissions:\n contents: read\n runs-on: windows-latest\n steps:\n - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0\n with:\n python-version: pypy-3.11\n - name: Downgrade pip\n run: |\n python -m pip install \"pip==26.1.2\"\n - name: Use pip\n run: |\n python -m pip install -U requests\n```\n\n\u003c/details>\n\n\n**Expected behavior:**\nThe downgraded pip should not be broken.\n\n**Actual behavior:**\nThe downgraded pip immediately raises an `ImportError` upon execution.\n\n\n**Analysis:**\n\nThe root cause seems to be `setup-python` unconditionally upgrading `pip` to the latest version using the `--ignore-installed pip` flag:\n\nhttps://github.com/actions/setup-python/blob/5fda3b95a4ea91299a34e894583c3862153e4b97/src/install-pypy.ts#L175-L183\n\nThe `--ignore-installed` option tells pip not to uninstall any existing version of the package, but instead to merely install on top of any existing packages. This seems to cause some confusion as to what version is actually installed, as evidenced by the `setup-python` output from the [example workflow run log](https://github.com/bashonly/setup-python-pypy-pip-bug/actions/runs/30870303776/job/91870770987):\n\n\u003cdetails>\u003csummary>setup-python log snippet\u003c/summary>\n\n```\n Installing and updating pip\n C:\\hostedtoolcache\\windows\\PyPy\\3.11.15\\x64\\python.exe -m ensurepip\n Looking in links: c:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpz17a6bza\n Processing c:\\users\\runner~1\\appdata\\local\\temp\\tmpz17a6bza\\setuptools-79.0.1-py3-none-any.whl\n Processing c:\\users\\runner~1\\appdata\\local\\temp\\tmpz17a6bza\\pip-24.0-py3-none-any.whl\n Installing collected packages: setuptools, pip\n WARNING: The scripts pip3.11.exe and pip3.exe are installed in 'C:\\hostedtoolcache\\windows\\PyPy\\3.11.15\\x64\\Scripts' which is not on PATH.\n Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.\n Successfully installed pip-24.0 setuptools-79.0.1\n C:\\hostedtoolcache\\windows\\PyPy\\3.11.15\\x64\\python.exe -m pip install --ignore-installed pip\n Collecting pip\n Downloading pip-26.2-py3-none-any.whl.metadata (4.6 kB)\n Downloading pip-26.2-py3-none-any.whl (1.8 MB)\n ---------------------------------------- 1.8/1.8 MB 38.4 MB/s eta 0:00:00\n Installing collected packages: pip\n WARNING: The scripts pip.exe, pip3.11.exe and pip3.exe are installed in 'C:\\hostedtoolcache\\windows\\PyPy\\3.11.15\\x64\\Scripts' which is not on PATH.\n Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.\n Successfully installed pip-24.0\n```\n\n\u003c/details>\n\nDuring the upgrade, pip knows it's installing version 26.2, but after installation is complete it reports that version 24.0 is installed. (pip 24.0 is the version that is bootstrapped with `ensurepip`.)\n\nIf we look at the \"Use pip\" step from [example workflow run log](https://github.com/bashonly/setup-python-pypy-pip-bug/actions/runs/30870303776/job/91870770987), we can see that our attempt to use pip 26.1.2 errors and emits the following traceback:\n```\n File \"C:\\hostedtoolcache\\windows\\PyPy\\3.11.15\\x64\\Lib\\site-packages\\pip\\_internal\\cli\\main_parser.py\", line 11, in \u003cmodule>\n from pip._internal.build_env import get_runnable_pip\n File \"C:\\hostedtoolcache\\windows\\PyPy\\3.11.15\\x64\\Lib\\site-packages\\pip\\_internal\\build_env\\__init__.py\", line 8, in \u003cmodule>\n from pip._internal.build_env.installer import (\n File \"C:\\hostedtoolcache\\windows\\PyPy\\3.11.15\\x64\\Lib\\site-packages\\pip\\_internal\\build_env\\installer.py\", line 22, in \u003cmodule>\n from pip._internal.utils.misc import get_runnable_pip\nImportError: cannot import name 'get_runnable_pip' from 'pip._internal.utils.misc' (C:\\hostedtoolcache\\windows\\PyPy\\3.11.15\\x64\\Lib\\site-packages\\pip\\_internal\\utils\\misc.py)\nError: Process completed with exit code 1.\n```\n\n`_internal\\build_env\\__init__.py` does not exist in `pip\u003c26.2`. This suggests that the file was left behind from the `pip` version 26.2 that was installed prior to the downgrade (possibly because the package metadata used to uninstall 26.2 actually belonged to version 24.0). It tries to import `get_runnable_pip` from `pip._internal.utils.misc`, but the function wasn't moved into that module until `pip` version 26.2, so the `ImportError` is raised.\n","author":{"url":"https://github.com/bashonly","@type":"Person","name":"bashonly"},"datePublished":"2026-08-04T02:50:17Z","url":"https://github.com/actions/setup-python/issues/1348"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:36e06215-3f79-c7f3-059f-d01f6ecd3a83 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ECA2:2E3FEE:4E94176:63259C5:6B02619A |
| html-safe-nonce | 05e36a333bae5ed8b4a2117ffbc805c7e9d663c9edf4fb52f7d7702ce0a29273 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQ0EyOjJFM0ZFRTo0RTk0MTc2OjYzMjU5QzU6NkIwMjYxOUEiLCJ2aXNpdG9yX2lkIjoiMTA0MTQ5MTc0OTU5MzMwOTU5NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e38db5de456fb5e0c23a28680d87ccb549fbdd2db829aaed8b3d8eed8b0b5d1c |
| hovercard-subject-tag | issue:5056152471 |
| github-keyboard-shortcuts | repository,issues,actions,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/actions/setup-python/1348/issue_layout |
| twitter:image | https://opengraph.githubassets.com/17b71b900fe07d40033c04fcfb1004f35de78c01fe651e77e760fee35560ba94/actions/setup-python/issues/1348 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/17b71b900fe07d40033c04fcfb1004f35de78c01fe651e77e760fee35560ba94/actions/setup-python/issues/1348 |
| og:image:alt | Description: When using the setup-python action with pypy-3.11 on Windows, installing a version of pip older than the version pre-installed by setup-python results in a completely broken pip. Here ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bashonly |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/actions/setup-python git https://github.com/actions/setup-python.git |
| octolytics-dimension-user_id | 44036562 |
| octolytics-dimension-user_login | actions |
| octolytics-dimension-repository_id | 192625525 |
| octolytics-dimension-repository_nwo | actions/setup-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 192625525 |
| octolytics-dimension-repository_network_root_nwo | actions/setup-python |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width