Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 895410 - =dev-python/pip-23.0 fails to install packages with "--user"
Summary: =dev-python/pip-23.0 fails to install packages with "--user"
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-19 12:43 UTC by Viacheslav Gagara
Modified: 2024-02-15 11:27 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Viacheslav Gagara 2023-02-19 12:43:04 UTC
Unable to install any package as normal user with `--user` option.
>error: externally-managed-environment

Reproducible: Always

Steps to Reproduce:
1. $ pip install --user jupyter
Actual Results:  
```
error: externally-managed-environment

× This environment is externally managed
╰─> 
    The system-wide Python installation in Gentoo should be maintained
    using the system package manager (e.g. emerge).
    
    If the package in question is not packaged for Gentoo, please
    consider installing it inside a virtual environment, e.g.:
    
    python -m venv /path/to/venv
    . /path/to/venv/bin/activate
    pip install mypackage
    
    To exit the virtual environment, run:
    
    deactivate
    
    The virtual environment is not deleted, and can be re-entered by
    re-sourcing the activate file.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider.
hint: See PEP 668 for the detailed specification.
```

Expected Results:  
package should install normally to ~/.local

Downgrading to pip-22.x fixes the issue.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-02-19 18:19:28 UTC
This is somewhat intentional on the pip side but https://github.com/pypa/pip/pull/11780 makes it much more tolerable.
Comment 2 Marat Radchenko 2023-03-13 07:08:36 UTC
I don't get how it can be intentional.

Error message talks about *system-wide* installation. "--user" is NOT *system-wide" installation.
Comment 3 Marat Radchenko 2023-03-13 07:45:26 UTC
Oh, I didn't notice link to https://github.com/pypa/pip/issues/11776. So, it is decision made by pip developers, not Gentoo.
Comment 4 Jari_42 2023-03-31 07:06:16 UTC
As mentioned in the upstream bug report, `--user` installation can be re-enabled by adding to ~/.config/pip/pip.conf:

[global]
break-system-packages = true
user = true
Comment 5 David Gasaway 2023-05-07 19:46:09 UTC
I just wanted to re-install a editable (`--user -e `) version of something I wrote myself.  All the dependencies are installed via `emerge`.  I have to turn on `break-system-packages` for that?  Hmmm.  Anyway, the upstream bugs were closed with the `--break-system-pacakges` argument added to pip 23.0.1, which is now stable in the tree.