This is the error message I get when I try to install the Python PowerLine extensions on Debian 12. I’ve searched quite a bit, looking for the most currently dated posts and errors. I finally found out what was happening when I searched for “python externally-managed-environment.” That led me to reading Python Enhancement Proposal (PEP) 668, Marking Python base environments as “externally managed.” Which after much reading of bloviating text I found out that;
- if the main Python directory, which can be identified by executing
sysconfig.get_path("stdlib", sysconfig.get_default_scheme())
, - which in Debian 12’s case returns
/usr/lib/python3.11
, - contains an empty file named
EXTERNALLY-MANAGED
, - then you’ll find it impossible to install any package into the distribution’s Python dist-packages directory, which in all cases for Python 3 is
/usr/lib/python3/dist-packages
Marvelous. Once I removed the EXTERNALLY-MANAGED
empty file I could indeed use pip to install packages. With powerline-status finally installed my shell prompt is as I like it and when I run vim, it’s status line is as I like it as well:
This is one of my stranger problems solved. I don’t know why Python 3 in Debian 12 is shipped this way, but it’s wrong. The question I have: is this a bug that needs to be reported, or is this considered a feature? This won’t be the first time devs have taken a holier-than-thou attitude towards end users. Consider systemd, for example.
You must be logged in to post a comment.