Skip to content

Commit 87fe6b4

Browse files
committed
Stop recommending user site packages
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. ```
1 parent 736275c commit 87fe6b4

2 files changed

Lines changed: 0 additions & 53 deletions

File tree

‎source/tutorials/installing-packages.rst‎

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -406,58 +406,6 @@ Upgrade an already installed ``SomeProject`` to the latest from PyPI:
406406
407407
.. _`Installing to the User Site`:
408408

409-
Installing to the User Site
410-
===========================
411-
412-
To install :term:`packages <Distribution Package>` that are isolated to the
413-
current user, use the ``--user`` flag:
414-
415-
.. tab:: Unix/macOS
416-
417-
.. code-block:: bash
418-
419-
python3 -m pip install --user SomeProject
420-
421-
.. tab:: Windows
422-
423-
.. code-block:: bat
424-
425-
py -m pip install --user SomeProject
426-
427-
For more information, see the `User Installs
428-
<https://pip.pypa.io/en/latest/user_guide/#user-installs>`_ section
429-
from the pip docs.
430-
431-
Note that the ``--user`` flag has no effect when inside a virtual environment
432-
– all installation commands will affect the virtual environment.
433-
434-
If ``SomeProject`` defines any command-line scripts or console entry points,
435-
``--user`` will cause them to be installed inside the `user base`_'s binary
436-
directory, which may or may not already be present in your shell's
437-
:envvar:`PATH`. (Starting in version 10, pip displays a warning when
438-
installing any scripts to a directory outside :envvar:`PATH`.) If the scripts
439-
are not available in your shell after installation, you'll need to add the
440-
directory to your :envvar:`PATH`:
441-
442-
- On Linux and macOS you can find the user base binary directory by running
443-
``python -m site --user-base`` and adding ``bin`` to the end. For example,
444-
this will typically print ``~/.local`` (with ``~`` expanded to the absolute
445-
path to your home directory), so you'll need to add ``~/.local/bin`` to your
446-
``PATH``. You can set your ``PATH`` permanently by `modifying ~/.profile`_.
447-
448-
- On Windows you can find the user base binary directory by running ``py -m
449-
site --user-site`` and replacing ``site-packages`` with ``Scripts``. For
450-
example, this could return
451-
``C:\Users\Username\AppData\Roaming\Python36\site-packages``, so you would
452-
need to set your ``PATH`` to include
453-
``C:\Users\Username\AppData\Roaming\Python36\Scripts``. You can set your user
454-
``PATH`` permanently in the `Control Panel`_. You may need to log out for the
455-
``PATH`` changes to take effect.
456-
457-
.. _user base: https://docs.python.org/3/library/site.html#site.USER_BASE
458-
.. _modifying ~/.profile: https://stackoverflow.com/a/14638025
459-
.. _Control Panel: https://learn.microsoft.com/en-us/windows/win32/shell/user-environment-variables
460-
461409
Requirements files
462410
==================
463411

‎source/tutorials/managing-dependencies.rst‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ Use ``pip`` to install Pipenv:
5252
packages. If ``pipenv`` isn't available in your shell after installation,
5353
you'll need to add the :py:data:`user base <python:site.USER_BASE>`'s
5454
binary directory to your ``PATH``.
55-
See :ref:`Installing to the User Site` for more information.
5655

5756
.. _npm: https://www.npmjs.com/
5857
.. _bundler: https://bundler.io/

0 commit comments

Comments
 (0)