I have tried to install any python packages on Ubuntu 24.04, but found I cannot do that as in 22.04
PEP668 said it is for avoiding package conflict between system-wide package and user installed package.
example:
$ pip install setuptools --usererror: externally-managed-environment× This environment is externally managed╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install. If you wish to install a non-Debian-packaged Python package, create a virtual environment using python3 -m venv path/to/venv. Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make sure you have python3-full installed. If you wish to install a non-Debian packaged Python application, it may be easiest to use pipx install xyz, which will manage a virtual environment for you. Make sure you have pipx installed. See /usr/share/doc/python3.11/README.venv for more information.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.
But if I do that with pipx
:
$ pipx install setuptools No apps associated with package pip or its dependencies. If you are attempting to install a library, pipx should not be used. Consider using pip or a similar tool instead.
I am really confused with current rules and can not install any package to user local env.
How can I manage my user local environment now? And how can I use latest pip
(not linux-distro version) and other packages by default for current user?
My Environment (docker):
FROM ubuntu:24.04# add pythonRUN apt install -y python3-pip python3-venv python-is-python3 pipxUSER ubuntuWORKDIR /app
I know I can use some env manage tools (pyenv) to do that, but is there any built-in method to bring my user local env back?