-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3.12 on Ubuntu 24.04 is Externally Managed - PIP is broken #10781
Python 3.12 on Ubuntu 24.04 is Externally Managed - PIP is broken #10781
Comments
Hi @molson504x , Thanks for bringing this issue to our notice. Will analyze the same and provide an update. |
Signed-off-by: Salvatore Mesoraca <[email protected]>
To unblock yourself, please consider using ubuntu-22.04 runner in your workflow.
Cause : |
Hey @subir0071 - yeah, that was one of our solutions. We actually did it a different way. We added a OR - even better would be to package the runner image with a python interpreter which is not externally managed. |
Hi @molson504x , Hope you are able to progress with your CI/CD workload. Kindly suggest on the closure of this ticket. Thanks. |
Hello @subir0071 👋 Are you suggesting that the issue will not be managed in the |
I can confirm that standard Ubuntu 24.04 throws this error as well. It will be necessary to replace the standard Python installation, whether by GitHub or by an action, to avoid it. |
This broke our builds too |
Agreed. The image documentation page lists:
Without any notes, it feels misleading to me to have this listed yet I would find it most convenient to be able to continue usage as with 22.04, but a documentation update seems reasonable. |
- Update commit-checker.yml to revert to runs-on: ubuntu-22.04 - issue in actions/runner-images#10781
for what it's worth, I was not able to reproduce this using an |
@subir0071 - Based on the post in #10636 I'm willing to close this, however this should still be addressed in documentation about Comment, for reference:
|
Closing this issue, per comment in #10636 - rolling back |
Yes, I know this has been closed, but I want to provide a few examples supporting my stance on this.
Red Hat / Fedora avoid this by shipping their own minimal Python install that system tools use, avoiding the user-facing one, but I don't think this scales especially if you're trying to keep image sizes down. The only reliable way to avoid it is to assume the system-provided language packages are intended to work with the system and install your own if you will be upgrading or installing additional packages not via the system's package manager. |
This reverts commit 318019a. Signed-off-by: Salvatore Mesoraca <[email protected]>
This is both wrong and fallaciously wrong. Inside of a temporary container, all the reasons for installing additional python interpreters just to have a different environment, are not applicable. The original rationale for this "Externally Managed" change even notes that scenario. But "Ubuntu Linux" doesn't know when it is being used "as a container", that's been deferred to container vendors such as Github Actions to fix by deleting the marker file. Of course, no container vendors bother to do so. |
@eli-schwartz wrote
I would agree, and note that specifically, at the end of this section of the Python docs:
However, the recommendation section here recommends to
|
Signed-off-by: Salvatore Mesoraca <[email protected]> Signed-off-by: Raphaël Vinot <[email protected]>
This reverts commit 318019a. Signed-off-by: Salvatore Mesoraca <[email protected]> Signed-off-by: Raphaël Vinot <[email protected]>
Signed-off-by: Salvatore Mesoraca <[email protected]> Signed-off-by: Raphaël Vinot <[email protected]>
This reverts commit 318019a. Signed-off-by: Salvatore Mesoraca <[email protected]> Signed-off-by: Raphaël Vinot <[email protected]>
Signed-off-by: Salvatore Mesoraca <[email protected]> Signed-off-by: Raphaël Vinot <[email protected]>
This reverts commit 318019a. Signed-off-by: Salvatore Mesoraca <[email protected]> Signed-off-by: Raphaël Vinot <[email protected]>
ubuntu-24.04 breaks `pip install` for system packages see also actions/runner-images#10781 action/setup-python would mitigate this effect but runs into different pip install build issues due to preinstalled sytem packages not found (i.e. cairo not found)
Just for visibility here, this issue will be coming back: |
Fixes actions#10781 Add a non-externally managed Python interpreter to the `ubuntu-24.04` runner image to avoid pip installation errors. * **Template Update** - Add a provisioner in `images/ubuntu/templates/ubuntu-24.04.pkr.hcl` to install a stand-alone Python interpreter. - Update environment variables to include the new Python path. * **Toolset Update** - Specify non-externally managed Python installations in `images/ubuntu/toolsets/toolset-2404.json`. * **Documentation Update** - Document the inclusion of a non-externally managed Python interpreter in `images/ubuntu/Ubuntu2404-Readme.md`. - Note the resolution of pip installation errors. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/actions/runner-images/issues/10781?shareId=XXXX-XXXX-XXXX-XXXX).
Description
Python 3.12 on the
ubuntu-24.04
image (which is also slowly becomingubuntu-latest
) is using an "Externally Managed" instance of Python - either it was installed via a package manager (apt?) or it is packaged with the OS. This also uses PIP 24, which (starting with PIP 23) enforces EXTERNALLY-MANAGED flagged python installs.If your workflow includes anything that tries to do a
pip install
to set up python dependencies, it will fail with an error similar to:We found this by accident because our workflows target
ubuntu-latest
which is slowly being changed to targetubuntu-24.04
instead ofubuntu-22.04
. We confirmed that adding asetup-python
step to our workflow (which sets up 3.12.3) fixes the problem because it'll install a stand-alone interpreter and update the system path to use that interpreter, however there is no documentation anywhere saying that is now a requirement. Hence this issue :)Platforms affected
Runner images affected
Image version and build link
HOWEVER, we were targeting
ubuntu-latest
and discovered on subsequent runs thatubuntu-latest
targetedubuntu-22.04
which made this intermittent for us. When we hard-targetedubuntu-24.04
we consistently reproduced this.I can't provide a build link due to client confidentiality purposes, however this is pretty easy to test.
Is it regression?
Yes (since the behavior of ubuntu-latest changed and broke a workflow)
Expected behavior
PIP should continue to work, or GitHub needs to formally publish the breaking change along with remediation steps (which is to use the setup-python action). Ideally, the version of Python that comes pre-installed on the runner image is not externally managed.
Actual behavior
See the error in the description... :)
Also - the inconsistency with using
ubuntu-latest
being eitherubuntu-22.04
andubuntu-24.04
is really bad. This is going to cause a lot of painful debugging for a lot of people because of this inconsistency causing intermediate but not repeatable failures.Repro steps
ubuntu-24.04
.REMEDIATION:
setup-python
) and then tries to use PIP. This workflow should targetubuntu-24.04
.The text was updated successfully, but these errors were encountered: