Error: externally-managed-environment

This environment is externally managed

This is because of different distributions adopting PEP 668 – Marking Python base environments as “externally managed”.

The solution is to use virtual environment.

python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -r requirements.txt

Your distribution is preventing you from combining packages installed via apt and pip to protect system stability. Using multiple package managers together often leads to conflicts and various issues.

Source:

  1. https://stackoverflow.com/questions/75602063/pip-install-r-requirements-txt-is-failing-this-environment-is-externally-manag/75696359#75696359