When using pip
command to install a Python package in Ubuntu 24.04 will output “error: externally-managed-environment“. Here are a few workarounds to ‘fix’ the issue.
As the terminal output shows you, it’s the change due to PEP 668. Since Ubuntu 23.04, it recommends Python-specific package management tools (e.g., pip) to install packages using a virtual environment, to avoid conflicts to packages installed by OS package managers. Though, user can still force pip to install into interpreter’s global context just like before.