From 87fe6b4fd6248a1bdfe47eccd27d31531f50fa91 Mon Sep 17 00:00:00 2001 From: konstin Date: Tue, 24 Nov 2026 11:52:01 +0100 Subject: [PATCH 1/2] Stop recommending user site packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. ``` --- source/tutorials/installing-packages.rst | 52 ---------------------- source/tutorials/managing-dependencies.rst | 1 - 2 files changed, 53 deletions(-) diff --git a/source/tutorials/installing-packages.rst b/source/tutorials/installing-packages.rst index 71aeb0119..6a4b249ad 100644 --- a/source/tutorials/installing-packages.rst +++ b/source/tutorials/installing-packages.rst @@ -406,58 +406,6 @@ Upgrade an already installed ``SomeProject`` to the latest from PyPI: .. _`Installing to the User Site`: -Installing to the User Site -=========================== - -To install :term:`packages ` that are isolated to the -current user, use the ``--user`` flag: - -.. tab:: Unix/macOS - - .. code-block:: bash - - python3 -m pip install --user SomeProject - -.. tab:: Windows - - .. code-block:: bat - - py -m pip install --user SomeProject - -For more information, see the `User Installs -`_ section -from the pip docs. - -Note that the ``--user`` flag has no effect when inside a virtual environment -– all installation commands will affect the virtual environment. - -If ``SomeProject`` defines any command-line scripts or console entry points, -``--user`` will cause them to be installed inside the `user base`_'s binary -directory, which may or may not already be present in your shell's -:envvar:`PATH`. (Starting in version 10, pip displays a warning when -installing any scripts to a directory outside :envvar:`PATH`.) If the scripts -are not available in your shell after installation, you'll need to add the -directory to your :envvar:`PATH`: - -- On Linux and macOS you can find the user base binary directory by running - ``python -m site --user-base`` and adding ``bin`` to the end. For example, - this will typically print ``~/.local`` (with ``~`` expanded to the absolute - path to your home directory), so you'll need to add ``~/.local/bin`` to your - ``PATH``. You can set your ``PATH`` permanently by `modifying ~/.profile`_. - -- On Windows you can find the user base binary directory by running ``py -m - site --user-site`` and replacing ``site-packages`` with ``Scripts``. For - example, this could return - ``C:\Users\Username\AppData\Roaming\Python36\site-packages``, so you would - need to set your ``PATH`` to include - ``C:\Users\Username\AppData\Roaming\Python36\Scripts``. You can set your user - ``PATH`` permanently in the `Control Panel`_. You may need to log out for the - ``PATH`` changes to take effect. - -.. _user base: https://docs.python.org/3/library/site.html#site.USER_BASE -.. _modifying ~/.profile: https://stackoverflow.com/a/14638025 -.. _Control Panel: https://learn.microsoft.com/en-us/windows/win32/shell/user-environment-variables - Requirements files ================== diff --git a/source/tutorials/managing-dependencies.rst b/source/tutorials/managing-dependencies.rst index 637d38e92..2094c729a 100644 --- a/source/tutorials/managing-dependencies.rst +++ b/source/tutorials/managing-dependencies.rst @@ -52,7 +52,6 @@ Use ``pip`` to install Pipenv: packages. If ``pipenv`` isn't available in your shell after installation, you'll need to add the :py:data:`user base `'s binary directory to your ``PATH``. - See :ref:`Installing to the User Site` for more information. .. _npm: https://www.npmjs.com/ .. _bundler: https://bundler.io/ From 64a2f303256f2e3c5db0d524d4117749e57caf6a Mon Sep 17 00:00:00 2001 From: konstin Date: Sun, 29 Nov 2026 14:10:04 +0100 Subject: [PATCH 2/2] Review --- ...talling-stand-alone-command-line-tools.rst | 28 ++----------------- source/tutorials/installing-packages.rst | 10 +++---- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/source/guides/installing-stand-alone-command-line-tools.rst b/source/guides/installing-stand-alone-command-line-tools.rst index c078fd1e4..c3b3312a9 100644 --- a/source/guides/installing-stand-alone-command-line-tools.rst +++ b/source/guides/installing-stand-alone-command-line-tools.rst @@ -20,31 +20,9 @@ that is on your ``$PATH``. This allows each package to be upgraded or uninstalled without causing conflicts with other packages, and allows you to safely run the applications from anywhere. -.. note:: pipx only works with Python 3.6+. - -pipx is installed with pip: - -.. tab:: Unix/macOS - - .. code-block:: bash - - python3 -m pip install --user pipx - python3 -m pipx ensurepath - -.. tab:: Windows - - .. code-block:: bat - - py -m pip install --user pipx - py -m pipx ensurepath - -.. note:: - - ``ensurepath`` ensures that the application directory is on your ``$PATH``. - You may need to restart your terminal for this update to take effect. - -Now you can install packages with ``pipx install`` and run the package's -applications(s) from anywhere. +After `installing pipx `_ +itself, you can then install packages with ``pipx install`` and run the +package's applications from anywhere: .. code-block:: console diff --git a/source/tutorials/installing-packages.rst b/source/tutorials/installing-packages.rst index 6a4b249ad..4e4d62c38 100644 --- a/source/tutorials/installing-packages.rst +++ b/source/tutorials/installing-packages.rst @@ -83,10 +83,10 @@ please install the latest 3.x version from `python.org`_ or refer to the .. Note:: Due to the way most Linux distributions are handling the Python 3 migration, Linux users using the system Python without creating a virtual environment first should replace the ``python`` command in this tutorial - with ``python3`` and the ``python -m pip`` command with ``python3 -m pip --user``. Do *not* - run any of the commands in this tutorial with ``sudo``: if you get a - permissions error, come back to the section on creating virtual environments, - set one up, and then continue with the tutorial as written. + with ``python3``. Do *not* run any of the commands in this tutorial with + ``sudo``: if you get a permissions error, come back to the section on + creating virtual environments, set one up, and then continue with the + tutorial as written. .. _getting started tutorial: https://opentechschool.github.io/python-beginners/en/getting_started.html#what-is-python-exactly .. _python.org: https://www.python.org @@ -404,8 +404,6 @@ Upgrade an already installed ``SomeProject`` to the latest from PyPI: py -m pip install --upgrade SomeProject -.. _`Installing to the User Site`: - Requirements files ==================