fix: pass --break-system-packages for uv-managed Python (PEP 668)#3073
Merged
Conversation
GPU builds on nvidia/cuda base images install Python via `uv python install`, which marks it as externally managed. uv 0.9.x enforces PEP 668, so pip refuses to install into that environment without --break-system-packages. The flag was already wired up behind SetBreakSystemPackages, but only the `cog base-image` CLI command called it. Normal `cog build` never did, breaking every GPU build that uses the CUDA base image path.
Contributor
|
LGTM |
markphelps
approved these changes
Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GPU builds on nvidia/cuda base images fail with
externally-managed-environmentbecauseuv python installmarks its Python as PEP 668 externally managed, and uv 0.9.x enforces it. pip refuses to install without--break-system-packages.The flag existed behind
SetBreakSystemPackages, but only thecog base-imageCLI called it. Normalcog buildnever did -- so every GPU build hitting the CUDA base image path broke.The fix adds
needsBreakSystemPackages()which auto-detects the uv-managed Python condition (same predicate asinstallPython()). All pip install and uninstall sites go through it.