How to Solve Pip Install Error on Ubuntu – Fix error: externally-managed-environment

How to solve error: externally-managed-environment PIP error on Ubuntu ?
If you are running Ubuntu 23.04 or later and try to run ‘pip install’ commend, then you will get this “error: externally-managed-environment“. Because you can not run pip install command outside a virtual environment to avoid conflicts between APT and Python package manager PIP.

Solve Pip Install Error

Fix Pip Install externally-managed-environment Error

Method 1: Use PIPX Install

Using pipx, you can easily Install and Run Python applications in Isolated Environments. In the terminal app (ctrl+alt+t) run below pipx install command.

sudo apt install pipx

and add it your PATH

pipx ensurepath

Now install any python app by replace pip to pipx like below

pipx install netpaint

[OR]

sudo pipx install netpaint

Here “netpaint” is the python app package name. You can replace it with your app name.

Also Read:  Linux Show Player - Cue Player For Stage Productions

Method 2: Create a virtual environment using venv or virtualenv

First install venv using below command.

sudo apt install python3-venv

Then create a new virtual environment in a directory named env using below command.

python3 -m venv env

To activate this virtual environment, run below command.

source env/bin/activate

Now you can install the python package via pip like this. The files will get installed under the env/ directory.

pip install netpaint
pip3 install netpaint

Method 3: Ignore the warning

You can also ignore the warning using the –break-system-packages flag in your pip install command. Like below command.

pip install --break-system-packages --user netpaint

That’s it.

If you liked this article, please subscribe to our YouTube Channel. You can also stay connected with us on X (Twitter) and Facebook.



Leave a Reply