Python3 pip install error - new-

something has changed since last week with python3. I build from source an application called MythTV and it usually has no issues if I get the dependencies right. However, today I did the make -j5 part without error, but the sudo make install has an issue.

This does not fail on Debian or Archlinux, but does generate the log error below on EOS XFCE4 on both x86_64 and arm64


make[1]: Entering directory '/home/jim/build/mythtv/mythtv/bindings/python'
python3 -m pip install   --no-build-isolation --no-cache-dir --no-index --disable-pip-version-check --no-deps --find-links ./dist MythTV
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
    python-xyz', where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Arch-packaged Python package,
    create a virtual environment using 'python -m venv path/to/venv'.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip.
    
    If you wish to install a non-Arch packaged Python application,
    it may be easiest to use 'pipx install xyz', which will manage a
    virtual environment for you. Make sure you have python-pipx
    installed via pacman.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
make[1]: *** [Makefile:35: install] Error 1

I ran into this when trying to install some pip modules in $HOME/.local/bin. This link gives a better explanation of what’s going on: https://pythonspeed.com/articles/externally-managed-environment-pep-668/

So why did it install okay on pure Archlinux and fail on Endeavour OS today. It worked on EOS last week?

What described there is what happened to me when I installed pip with python -m ensurepip and then tried to install setuptools with pip.
I had to install both with yay -S python-pip python-setuptools.

Confirmed that this works on my Arch VMs as well; didn’t try Debian 12.

This still doesn’t answer my question of why does my application’s sudo make install work on Archlinux and fail on EOS. What changed to EOS that now requires some special PEP 668 changes??

no answer to your question, but what if I want to switch to yay provided packeges now?

e.g. I have “black” installed witk pip install black --usera year ago and now get this error. If I now yay python-black am I on the system ptovided packages?

pip uninstall black --userdoes not work as it gives me the same error system managed blabla

How to get rid of the old user pythin pip packages? Delete manually from .local/bin/ ?

Also from .local/man, ./local/lib, and .local/share.

This is how I got around it. Since it was provided to me by a developer I’d say folks are not really doing what the intent of this PEP668 is all about. Not every package is provided by a corporate IT department

sudo PIP_BREAK_SYSTEM_PACKAGES=1 make install

I still don’t understand why Arch linux is not forcing this but EOS is?