How to fix pip in debian

Well meaning folks have broken pip: PEP 668 -- now, pip install whatever will fail with "error: externally-managed-environment" even if the intent is to install to the user's local "site-packages" area.

If it hasn't affected you yet, it'll affect you with the system python packages in debian testing.

The rationale is solid (-ish) but I prefer things to work as they do now, without changing EVERY pip install line in EVERYthing I cut and paste from the internet (to add --break-system-packages to the commandline).

The solution, at least until a "super PEP 668", is to remove the marker file EXTERNALLY-MANAGED. However, just doing a "sudo rm" won't stick when the package is updated by apt.

Here's one way to durably put aside the 'EXTERNALLY-MANAGED' marker of your system Python installation:

dpkg-divert --divert /usr/lib/python3.11/NOT-EXTERNALLY-MANAGED  --rename /usr/lib/python3.11/EXTERNALLY-MANAGED
This "diverts" (renames) the file, in a way that is respected by dpkg.

Entry first conceived on 15 March 2023, 19:31 UTC, last modified on 20 March 2023, 2:49 UTC
Website Copyright © 2004-2021 Jeff Epler