Pip can not install anything

I was sure that I was using pip without any problem, now every-time I use it I get the error:

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.

Any idea to make pip working again?

You need to remove /usr/lib/python3.12/EXTERNALLY-MANAGED.
(replace 3.12 as necessary for your python version).

There may be a good reason for this existing (I know bugger-all about Python) but I removed it some time ago because I needed pip packages and I’ve never seen any deleterious effects.

[Edit]: I’ve just spotted that you can also use:
pip install package_name --break-system-packages
if you prefer not to remove the file. Though it’s going to be a pain having to remember that every time you use pip.

If it exists (since 2023-06-21), there’s a good reason. The correct procedure is in the returned text.

rm file or use break-system-packages is clear !!! --break-system-packages == (i can) break (my) system

Breaking your OS and bringing it to an unsupported state is not a very good advice, IMHO.

2 Likes

Whatever deleterious effects there may be (and I haven’t seen any), it certainly hasn’t broken my OS. At worst it would only affect Python programs, not the OS itself.

This problem has been known for years! It’s nothing new, it’s just that pip is now blocking this bad installation method.

Did you know that an application has dependencies? And that an application is written to work with a certain version of its dependency. Here, you are disregarding pacman, so

  • a system python application (for example, pacman-mirrors) may no longer work with your intervention
  • If tomorrow, you install again with pip, you could break the dependency of the today application.
  • you are committing to managing updates for these dependencies yourself and manually.

If you want to take risks and manage your python packages yourself, that’s your problem. You just need to think about why you want to take this risk and this workload (if it’s out of laziness or wanting to maintain a very bad habit …)

hasn’t broken my OS

But at least break pacman updates (file conflicts)

only affect Python programs

can affect all application who use python !
example : inkscape, use some python packages, samba have some optional python packages, …


This system was created a year ago by Python, and you assume they did it and that every distribution adopted it without a valid reason…

3 Likes

From the moment I installed Manjaro, I already took a risk! I understand the concerns about managing Python dependencies and the potential risks involved. For less common packages, using pip is a standard and acceptable solution (I think), for instance I need to install the pandas-ods-reader package, which is not available through pacman. Therefore, I have to use pip to install it.

:rofl:
Now, I understand the attitude, you’re already expecting a crash.

With no context, you can do whatever you want…

Are you a python developer (you’re already using virtual environments for python, why change now ?) or a user (this isn’t a package, it’s an app)?

  1. You don’t want to create a package (aur) for this application
  2. You don’t want to use the available python tools (pipx, poetry, uv, conda,…)

not available through pacman.

as usual

  • pacman : 10 000 packages
  • aur : 90 000 packages
  • pypi : > 500 000 packages

Not new since one year :wink:

OK, I started

$python -m venv grades
$source grades/bin/activate
$(grades)pip install --upgrade pip

and continue to install my packages using pip
ps : I am from debian, where anything I need I usually install them system-wide.

Debian has followed PEP 668 since Bookworm.

1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.