Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 895410

Summary: =dev-python/pip-23.0 fails to install packages with "--user"
Product: Gentoo Linux Reporter: Viacheslav Gagara <viacheslavg>
Component: Current packagesAssignee: Python Gentoo Team <python>
Status: UNCONFIRMED ---    
Severity: normal CC: arcctgx, esigra, gentoo, mail, pacho
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
See Also: https://github.com/pypa/pip/issues/11776
https://github.com/pypa/pip/pull/11780
Whiteboard:
Package list:
Runtime testing required: ---

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.