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
This commit is contained in:
+5
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user