Skip to content

Stop recommending user site packages - #2214

Merged
rgommers merged 2 commits into
python:mainfrom
konstin:konsti/dont-use-user-site
Nov 29, 2026
Merged

rgommers merged 2 commits into
python:mainfrom
konstin:konsti/dont-use-user-site

Conversation

@konstin

@konstin konstin commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

User site packages may not be writable anymore with PEP 668, as it is the case on my system (see below). User site packages also don't provide isolation of packages against each other and can get into an inconsistent state. We should not advertise --user to users (uv doesn't implement support for it at all for those reasons). This PR removes the section that recommends using them.

I've left the pip install --user Pipenv section since it matches https://github.com/pypa/pipenv#installation. Pipenv likely needs to adopt a recommendation similar to the one from pipx (https://pipx.pypa.io/stable/how-to/install-pipx.html#linux)

$ pip install --user tqdm
error: 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.14/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.

AI usage disclosure

I used Codex for Git and formattings. Text edits are mine.


📚 Documentation preview 📚: https://python-packaging-user-guide--2214.org.readthedocs.build/en/2214/

User site packages may not be writable anymore with PEP 668, as it is the case on my system (see below). User site packages also don't provide isolation of packages against each other and can get into an inconsistent state. We should not advertise `--user` to users. This PR removes the section that recommends using them.

I've left the `pip install --user` Pipenv section since it matches https://github.com/pypa/pipenv#installation. Pipenv likely needs to adopt a recommendation similar to the one from pipx (https://pipx.pypa.io/stable/how-to/install-pipx.html#linux)

```
$ pip install --user tqdm
error: 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.14/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.
```
@rgommers rgommers added component: tutorials type: maintenance Regular maintenance of the guide, CI and repo labels Nov 29, 2026

@rgommers rgommers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @konstin, this is a useful cleanup, --user is discouraged and should not be recommended in this guide. This LGTM, there's one little leftover that I commented on inline that should be cleaned up before merging.

In addition, I found two more places that --user should be cleaned up. That can be done in this PR or left for later, up to you:

  • In source/guides/installing-stand-alone-command-line-tools.rst for pipx, the install command can be replaced with a link to https://pipx.pypa.io/stable/how-to/install-pipx.html, which will be more concise and already has up-to-date guidance.
  • In this same tutorial, there is a mention left for --user in the note on line 83. That should instead say that if you're on Linux, don't use sudo but create a virtual environment.

@konstin

konstin commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

Good idea, done.

@rgommers rgommers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, nice cleanups, 100% ready now so in it goes. Thanks @konstin!

@rgommers
rgommers added this pull request to the merge queue Nov 29, 2026
Merged via the queue into python:main with commit fcaaf74 Nov 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: tutorials type: maintenance Regular maintenance of the guide, CI and repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants