From e8667f02cf5787515d511af83c183b49b8353ba0 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 4 Jun 2026 00:01:57 +0000 Subject: [PATCH] pip_user_install: add --break-system-packages on Ubuntu 24.04+ pip3 install --user alone does not reliably bypass PEP 668 in all 24.04 environments. --break-system-packages (pip 22.3+) is the correct override. Flag is only added when ubuntu_version_ge "24.04" so it does not run on Ubuntu 22.04 where pip 22.0 ships and the flag is not yet supported. https://claude.ai/code/session_01Y4dMKtkqkpvmgDKoRdzhTG --- lib/common.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/common.sh b/lib/common.sh index ea68faa..0b44ba5 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -124,9 +124,12 @@ ubuntu_version_ge() { } # pip install --user as actual user. -# Centralised so any future version-specific pip flags land in one place. +# --break-system-packages (pip 22.3+) is required on Ubuntu 24.04+ where PEP 668 +# marks the system Python as externally managed; --user alone is not always enough. pip_user_install() { - sudo -u "$ACTUAL_USER" pip3 install --user --quiet "$@" + local flags="--user --quiet" + ubuntu_version_ge "24.04" && flags="$flags --break-system-packages" + sudo -u "$ACTUAL_USER" pip3 install $flags "$@" } detect_os