Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
tl;dr: There's a few ways to bypass this: For all users on the machine: Get rid of /usr/lib/python3.foo/EXTERNALLY-MANAGED. To prevent your package manager from adding it back, replace it with a...
Answer
#4: Post edited
There's a few ways to bypass this silliness:- * For all users on the machine: Get rid of `/usr/lib/python3.foo/EXTERNALLY-MANAGED`. To prevent your package manager from adding it back, replace it with a dummy/empty file. (you'll have to do this again for every minor Python version)
- * For your user only: Create or edit `~/.config/pip/pip.conf` so that it contains:
- ```
- [global]
- break-system-packages = true
- ```
- * For one shell session: Set the environment variable `PIP_BREAK_SYSTEM_PACKAGES=1` (you can configure your shell to always set this)
- * For one command only: Pass `--break-system-packages` to pip.
Why?A few years ago, Python devs decided that simply installing packages with `pip install foo` is bad and evil. So now they want you to wait for your distro to repackage it (for example, instead of `pip install requests` you're supposed to do [`pacman -S python-requests`](https://archlinux.org/packages/extra/any/python-requests/)), or create a venv and install everything in there.I won't reproduce the Python devs' rationale here; it is readily available in PEP 668 and other answers here. But if you want to follow the spirit of their decision with less inconvenience, your best bet is probably to create a new (non-system) Python with https://github.com/pyenv/pyenv and make that the default for your shell.
- **tl;dr:** There's a few ways to bypass this:
- * For all users on the machine: Get rid of `/usr/lib/python3.foo/EXTERNALLY-MANAGED`. To prevent your package manager from adding it back, replace it with a dummy/empty file. (you'll have to do this again for every minor Python version)
- * For your user only: Create or edit `~/.config/pip/pip.conf` so that it contains:
- ```
- [global]
- break-system-packages = true
- ```
- * For one shell session: Set the environment variable `PIP_BREAK_SYSTEM_PACKAGES=1` (you can configure your shell to always set this)
- * For one command only: Pass `--break-system-packages` to pip.
- (there used to be some thoughts here on why this has become necessary in recent years, but it proved controversial and I removed it)
#1: Initial revision
There's a few ways to bypass this silliness: * For all users on the machine: Get rid of `/usr/lib/python3.foo/EXTERNALLY-MANAGED`. To prevent your package manager from adding it back, replace it with a dummy/empty file. (you'll have to do this again for every minor Python version) * For your user only: Create or edit `~/.config/pip/pip.conf` so that it contains: ``` [global] break-system-packages = true ``` * For one shell session: Set the environment variable `PIP_BREAK_SYSTEM_PACKAGES=1` (you can configure your shell to always set this) * For one command only: Pass `--break-system-packages` to pip. Why? A few years ago, Python devs decided that simply installing packages with `pip install foo` is bad and evil. So now they want you to wait for your distro to repackage it (for example, instead of `pip install requests` you're supposed to do [`pacman -S python-requests`](https://archlinux.org/packages/extra/any/python-requests/)), or create a venv and install everything in there. I won't reproduce the Python devs' rationale here; it is readily available in PEP 668 and other answers here. But if you want to follow the spirit of their decision with less inconvenience, your best bet is probably to create a new (non-system) Python with https://github.com/pyenv/pyenv and make that the default for your shell.