Skip to contentSkip to conversation

README.rst: switch "Installing" section to "pipx"

PATCH In review Marc Herbert 2 participants 2 messages Nov 21, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 README.rst: switch "Installing" section to "pipx"

The previous, pip-based instructions on any recent Linux distribution (less than a few years old) fail instantly with the well-known "externally managed" error documented at
https://peps.python.org/pep-0668/ and quoted below.

Follow the well tested and proven "pipx" recommendation found in this error message and switch the README.txt to it. Provide a pointer to how to install pipx itself. Mention PEP 668 to justify the cost of the extra step and extra pipx dependency.

$ python3 -m pip install b4
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/Arch/etc.-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 <===== pipx =====
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.12/README.venv for more information.

---
 README.rst | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
README.rst +13 -3
index 990a3c5cb6f2..5cb9b601d55c 100644
@@ -12,13 +12,23 @@ See https://b4.docs.kernel.org/ for online documentation.
 
 Installing
 ----------
-To install the latest released version with pip::
+Since 2021-2022, ``pipx`` is recommended to download Python packages and
+their dependencies and install them in isolated environments that
+conflict with neither the operating system, nor with other packages.  If
+you are interested why, see Python document PEP 668. Note: ``pipx``
+existed and worked long before 2021 and PEP 668.
 
-    python3 -m pip install b4
+If you have not already, install ``pipx``. Usually from your Linux
+distribution: https://pipx.pypa.io/latest/installation/
+
+Then, install the latest ``b4`` release from pypi.org::
+
+    pipx install -v b4
+    pipx list
 
 Or to install the latest master (warning, maybe broken!)::
 
-    python3 -m pip install git+https://git.kernel.org/pub/scm/utils/b4/b4.git@master
+    pipx install -v git+https://git.kernel.org/pub/scm/utils/b4/b4.git@master
 
 Shell completion
 ----------------

---
base-commit: 477734000555ffc24bf873952e40367deee26f17
change-id: 20251121-readme-pipx-1461291bde75

Best regards,

Signature · 1 line
Marc Herbert <[email protected]>
#1 lore raw

On Fri, Nov 21, 2025 at 08:39:05PM +0000, Marc Herbert wrote:

Thank you for your patch!

README.rst See https://b4.docs.kernel.org/ for online documentation. · line 19

Quoted 8 lines

Installing
----------

README.rst +5 -1
-To install the latest released version with pip::
+Since 2021-2022, ``pipx`` is recommended to download Python packages and
+their dependencies and install them in isolated environments that
+conflict with neither the operating system, nor with other packages.  If
+you are interested why, see Python document PEP 668. Note: ``pipx``
+existed and worked long before 2021 and PEP 668.

We don't really need the explanatory note here -- the purpose of the README is to get people up to speed with minimal information overload. I think something like this will do:

To install the latest released version use ``pipx``, which should install all dependencies without conflicting with your system packages::

pipx install b4

README.rst See https://b4.docs.kernel.org/ for online documentation. · line 22

Quoted 3 lines
README.rst +2 -1
-    python3 -m pip install b4
+If you have not already, install ``pipx``. Usually from your Linux
+distribution: https://pipx.pypa.io/latest/installation/

I would put this in docs/installing.rst, because that needs to be updated, too.

README.rst See https://b4.docs.kernel.org/ for online documentation. · line 27

Quoted 5 lines
README.rst +5 -0
+
+Then, install the latest ``b4`` release from pypi.org::
+
+    pipx install -v b4
+    pipx list

We don't need the "list" step.

README.rst See https://b4.docs.kernel.org/ for online documentation. · line 31

Quoted 5 lines

Or to install the latest master (warning, maybe broken!)::

README.rst +1 -1
-    python3 -m pip install git+https://git.kernel.org/pub/scm/utils/b4/b4.git@master
+    pipx install -v git+https://git.kernel.org/pub/scm/utils/b4/b4.git@master

This is ok.

So, we just need the bare minimal instructions in README.rst and then slightly longer instructions, with details where to get pipx if it's not available on the person's distro (I doubt) in docs/installing.rst.

-K