LWN: Comments on "Cooperative package management for Python" https://lwn.net/Articles/867657/ This is a special feed containing comments posted to the individual LWN article titled "Cooperative package management for Python". en-us Tue, 04 Nov 2025 20:20:23 +0000 Tue, 04 Nov 2025 20:20:23 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Cooperative package management for Python https://lwn.net/Articles/868822/ https://lwn.net/Articles/868822/ laarmen <div class="FormattedComment"> You&#x27;re focusing on the functionality here, but there&#x27;s an important point made by stefanor : venv pulls in several MiB of dependencies.<br> <p> My guess is that a choice has been made to spare those MiB for all the Debian installs which simply want to use a Python program, not *develop* one (or deploy an application with dependencies not satisfied by Debian...). This is fairly logical and in keeping with other Debian packaging practices, such as not shipping the library headers with the main lib package, etc...<br> <p> And yes, there&#x27;s a lot of other ways some space could be saved on Debian installs.<br> </div> Fri, 10 Sep 2021 09:09:13 +0000 Cooperative package management for Python https://lwn.net/Articles/868629/ https://lwn.net/Articles/868629/ j0057 <div class="FormattedComment"> Oh right, I see, and Debian uses it to keep system-Python dist-packages separate from self-compiled-Python site-packages, so a slightly different use case than keeping system Python packages separate from user-installed Python packages.<br> </div> Wed, 08 Sep 2021 12:54:47 +0000 Cooperative package management for Python https://lwn.net/Articles/868590/ https://lwn.net/Articles/868590/ dbnichol <div class="FormattedComment"> I&#x27;m not sure exactly how it works now, but <a href="https://lists.debian.org/debian-python/2014/05/msg00025.html">https://lists.debian.org/debian-python/2014/05/msg00025.html</a> has some background.<br> </div> Tue, 07 Sep 2021 18:22:33 +0000 Cooperative package management for Python https://lwn.net/Articles/868528/ https://lwn.net/Articles/868528/ nevyn <div class="FormattedComment"> <font class="QuotedText">&gt; So the distro package of python3 may not include all the standard library</font><br> <p> Using the word &quot;python3&quot; as though it&#x27;s a single thing is confusing you, and probably others trying to follow along. For almost any project in a distribution you have at least three things worth talking about: 1) All of it (roughly what you get if you installed from an upstream tarball). 2) The major usable piece of it (/usr/bin/python3 and all of stdlib. so you can run arbitrary python3 programs, in this case). 3) Specific dependencies so that distribution package FOO can run correctly.<br> <p> All three of those things might install /usr/bin/python3, and could thus. be called &quot;python3&quot; but are likely to be very different otherwise.<br> </div> Tue, 07 Sep 2021 04:47:26 +0000 Cooperative package management for Python https://lwn.net/Articles/868514/ https://lwn.net/Articles/868514/ Conan_Kudo "dist-packages" was always a Debian-ism. At least I've never seen it in any other distribution family. Ruby has a concept of "vendor directories" and "site directories", and Python would probably benefit from a standardized approach like that. Mon, 06 Sep 2021 23:35:01 +0000 Cooperative package management for Python https://lwn.net/Articles/868407/ https://lwn.net/Articles/868407/ j0057 <div class="FormattedComment"> It used to be that distros were expected to put Python packages in dist_packages and admins their packages in site_packages. I&#x27;m probably missing something, but that always seemed fairly sane to me. Most distros however put their Python packages in site-packages. Debian still does it this way, so it doesn&#x27;t seem entirely unsupported.<br> </div> Sun, 05 Sep 2021 20:35:38 +0000 Cooperative package management for Python https://lwn.net/Articles/868209/ https://lwn.net/Articles/868209/ NYKevin <div class="FormattedComment"> % apt show ca-certificates<br> Package: ca-certificates<br> Version: 20210119<br> Priority: optional<br> Section: misc<br> Maintainer: Julien Cristau &lt;jcristau@debian.org&gt;<br> Installed-Size: 391 kB<br> Depends: openssl (&gt;= 1.1.1), debconf (&gt;= 0.5) | debconf-2.0<br> Breaks: ca-certificates-java (&lt;&lt; 20121112+nmu1)<br> Enhances: openssl<br> Download-Size: 247 kB<br> APT-Manual-Installed: yes<br> APT-Sources: [my employer&#x27;s private mirror]<br> Description: Common CA certificates<br> Contains the certificate authorities shipped with Mozilla&#x27;s browser to allow<br> SSL-based applications to check for the authenticity of SSL connections.<br> .<br> Please note that Debian can neither confirm nor deny whether the<br> certificate authorities whose certificates are included in this package<br> have in any way been audited for trustworthiness or RFC 3647 compliance.<br> Full responsibility to assess them belongs to the local system<br> administrator.<br> <p> I am willing to concede that it is technically possible that someone, somewhere, might not want to have this ~400 KiB package, and/or OpenSSL, installed.<br> <p> The other five, however, are nonsense. Two of the packages you list are just more specific versions of venv, and pip-whl and distutils are both part of the Python stdlib proper, which Debian has artificially split out. That leaves lib2to3, and I would be shocked if that *wasn&#x27;t* self-inflicted by Debian supporting old versions of Python. Upstream certainly shouldn&#x27;t be depending on it anymore.<br> <p> In short: The only real argument I&#x27;m seeing here is &quot;some people want Python, but don&#x27;t want OpenSSL.&quot; I&#x27;m skeptical that this is a very large or interesting class of users, worth the inconvenience it causes to everybody else.<br> <p> <font class="QuotedText">&gt; The harried sysadmin you describe will get an error message describing exactly what they need to do to resolve their issue.</font><br> <p> No. They will click the big shiny &quot;deploy&quot; button, deployment will not actually happen, and they will then spend 20+ minutes digging through logs until they eventually figure out that it&#x27;s the venv step which is failing.<br> </div> Thu, 02 Sep 2021 19:14:46 +0000 Cooperative package management for Python https://lwn.net/Articles/868187/ https://lwn.net/Articles/868187/ kpfleming <div class="FormattedComment"> ... with the inevitable result that such &#x27;ugly&#x27; flags will just be subsumed into a curlbash URL that the tutorial tells you to execute.<br> </div> Thu, 02 Sep 2021 16:45:54 +0000 Cooperative package management for Python https://lwn.net/Articles/868094/ https://lwn.net/Articles/868094/ stefanor <div class="FormattedComment"> <font class="QuotedText">&gt; There is no logical reason for that limitation.</font><br> <p> Yes there is, it&#x27;s minimising the payload of Python to support applications written in Python.<br> <p> On a clean Debian bullseye install, installing python3-venv requires an additional 7 binary packages using 5MiB of disk space, over just python3.<br> They are: ca-certificates openssl python-pip-whl python3-distutils python3-lib2to3 python3-venv python3.9-venv<br> <p> We&#x27;ve simplified things over time. python-pip-whl currently contains 31 wheels, in the past these were all separate binary packages.<br> <p> The harried sysadmin you describe will get an error message describing exactly what they need to do to resolve their issue. This probably one of tens of such issues they&#x27;ll see while automating their deployment.<br> <p> <p> </div> Thu, 02 Sep 2021 00:22:00 +0000 Cooperative package management for Python https://lwn.net/Articles/868090/ https://lwn.net/Articles/868090/ NYKevin <div class="FormattedComment"> There is no logical reason for that limitation. The only thing that venv actually does is make a directory with a very specific set of regular files and directories underneath. It does not interact with the system&#x27;s package manager or site-packages in any way. The scripts which it creates are specifically designed to *prevent* the user from interacting with the system&#x27;s package manager or site-packages. venv is not &quot;just for developers&quot; either, since it can used in (for example) an automated deployment script for a cattle-not-pets environment. That&#x27;s why it has a programmatic interface.<br> <p> Maybe you disagree with me about where exactly to draw the line between &quot;developer-oriented&quot; and &quot;regular&quot; parts of the stdlib. But for better or for worse, the documentation at docs.python.org strongly suggests that this is a standard part of Python, and that the harried sysadmin who just wants to automate their deployment process (without doing a whole lot of faffing about with Docker and Kubernetes) can reasonably assume it will work, because it&#x27;s part of the whole Batteries Included thing. And of course, it actually *does* work on the sysadmin&#x27;s laptop, because at some point they installed venv or something which depends on it, and then forgot about it, because setting up a venv is practically the first thing you do after you graduate from writing Hello World programs in Python.<br> <p> I can understand limiting ensurepip so that it can only install into venv. But splitting out venv altogether just smacks of the pretentious &quot;for your own good&quot; nonsense I got sick of with the GNOME folks years ago. This is not some huge package like GCC or Make, nor is it a set of bindings to a big thing that might not be installed (like Tkinter). venv is a relatively small set of self-contained tools which upstream has loudly advertised as Included.™ I don&#x27;t see which users actually benefit from breaking it out into a separate package, unless the only benefit is a slightly smaller installation size. But then you might as well go around breaking everything out into separate packages. Let&#x27;s have python3-pathlib and python3-itertools and python3-enum and...<br> </div> Wed, 01 Sep 2021 22:42:59 +0000 Cooperative package management for Python https://lwn.net/Articles/868089/ https://lwn.net/Articles/868089/ stefanor <div class="FormattedComment"> <font class="QuotedText">&gt; For quite a while, this was not the case, and you simply got a broken venv. Fortunately, it would print an error message explaining the problem, but that&#x27;s still incredibly obnoxious behavior.</font><br> <p> That is still the case. It doesn&#x27;t complete creating the venv, prints an error explaining why, and exits non-zero.<br> </div> Wed, 01 Sep 2021 22:16:21 +0000 Cooperative package management for Python https://lwn.net/Articles/868086/ https://lwn.net/Articles/868086/ NYKevin <div class="FormattedComment"> I&#x27;m fairly certain that&#x27;s the whole point. By using a blunt, &quot;why would I ever want to do that?&quot; flag name, you discourage users from blindly copy/pasting garbage commands into their terminals from some poorly-written tutorial they found on the web somewhere.<br> </div> Wed, 01 Sep 2021 21:59:44 +0000 Cooperative package management for Python https://lwn.net/Articles/868074/ https://lwn.net/Articles/868074/ NYKevin <div class="FormattedComment"> The problem is that nobody wants this:<br> <p> 1. The vast majority of the time, a regular end user (not a developer) either wants to install via their native package manager, or via something like an Ubuntu PPA or Snap/Flatpak. Using pip is a Bad Idea because tools like unattended-upgrades don&#x27;t know how to interact with it (so you don&#x27;t get automated security updates, your sysadmin can&#x27;t audit your installed packages, etc. unless someone goes around building out all of that functionality to support pip). Also, pip can easily install packages which are Not Ready For Production Use,™ usually with very little or no warning to the end user, because it&#x27;s a developer-oriented tool.<br> 2. The vast majority of the time, a developer wants to install into a venv (virtualenv, or &quot;virtual environment&quot;), which is basically a directory with a bunch of locally-installed pip packages and some environment-variable-modifying scripts. The net effect is that, when the venv is &quot;active,&quot; Python looks inside the venv before or instead of the system-wide packages. venvs are very lightweight; you can remove them with rm -r, and they leave no trace on the system. In practice, most native package managers are not designed to do that sort of thing (unless you use something much heavier than a venv, such as spinning up an entire Docker container).<br> </div> Wed, 01 Sep 2021 21:12:05 +0000 Cooperative package management for Python https://lwn.net/Articles/868071/ https://lwn.net/Articles/868071/ NYKevin <div class="FormattedComment"> <font class="QuotedText">&gt; When used by the venv module, it just does what you expect, and creates a venv seeded with pip.</font><br> <p> For quite a while, this was not the case, and you simply got a broken venv. Fortunately, it would print an error message explaining the problem, but that&#x27;s still incredibly obnoxious behavior.<br> </div> Wed, 01 Sep 2021 20:59:29 +0000 Cooperative package management for Python https://lwn.net/Articles/868069/ https://lwn.net/Articles/868069/ cyperpunks <div class="FormattedComment"> Could an unified package manager (upip) be an ok idea?<br> <p> $ upip install spam<br> <p> will first search distro repos for spam and install found package by native pkg package tool.<br> <p> If not found in native repos, jump to pip (in the background of course) and install into special pip dirs <br> (which are outside native pkg manager dirs.)<br> <p> Keep track of packaged install by both pip and native tooling.<br> <p> If doing:<br> <p> $ upip remove eggs<br> <p> would break something in either systems it will complain and prevent such action.<br> <p> <p> <p> <p> <p> <p> <p> </div> Wed, 01 Sep 2021 20:42:10 +0000 Cooperative package management for Python https://lwn.net/Articles/868045/ https://lwn.net/Articles/868045/ stefanor <div class="FormattedComment"> The easy way to find out the details is to look at what python3-full depends on.<br> <p> The written documentation for the split is here:<br> <a href="https://www.debian.org/doc/packaging-manuals/python-policy/index.html#main-packages">https://www.debian.org/doc/packaging-manuals/python-polic...</a><br> And yes, that often lags behind the reality in the archive, it&#x27;s easy to forget to update documentation. It is currently accurate, though.<br> </div> Wed, 01 Sep 2021 18:22:36 +0000 Cooperative package management for Python https://lwn.net/Articles/868040/ https://lwn.net/Articles/868040/ mathstuf <div class="FormattedComment"> Perhaps better would be &quot;--i-read-the-docs-and-allow-pip-to-break-things-it-thinks-it-should-not-touch&quot;. Everyone is going to be copy-pasting (or (ha!) tab completing) this anyways, so why make it convenient?<br> </div> Wed, 01 Sep 2021 18:08:19 +0000 Cooperative package management for Python https://lwn.net/Articles/868038/ https://lwn.net/Articles/868038/ MattBBaker <div class="FormattedComment"> <font class="QuotedText">&gt; ‑‑break‑system‑packages</font><br> <p> Oh this is going to be a fun flag to explain to users.<br> &quot;Why would I want an option to hose my system install?&quot;<br> &quot;Okay, it&#x27;s not an affirmative action telling it to hose your system. Pip just gained the ability to tell if your about to hose your system, and advise you not to. But give you the option to do it anyways if you really want to.&quot;<br> </div> Wed, 01 Sep 2021 17:48:17 +0000 Cooperative package management for Python https://lwn.net/Articles/867982/ https://lwn.net/Articles/867982/ xecycle <div class="FormattedComment"> Not really related to your main point, but python defaults to include $PWD in its sys.path when you say -m without -I, and $PWD can shadow standard libraries (except sys). So if you consider $PWD as untrusted, or if you have some surprisingly-named .py files on $PWD, then that command won’t work, regardless of distro.<br> </div> Wed, 01 Sep 2021 14:27:45 +0000 Cooperative package management for Python https://lwn.net/Articles/867981/ https://lwn.net/Articles/867981/ martin.langhoff <div class="FormattedComment"> As a former distro packager _and_ library developer I really like this. <br> <p> - &quot;EXTERNALLY_MANAGED&quot; indicates perspective - external to whom?. Instead, doing something like `echo rpm &gt; MANAGED_BY` is much better, scalable, future-proof.<br> <p> - We need this same dialog (and mechanisms) for PHP, Perl, Ruby, JS...<br> <p> <p> </div> Wed, 01 Sep 2021 14:22:41 +0000 Cooperative package management for Python https://lwn.net/Articles/867979/ https://lwn.net/Articles/867979/ beagnach <div class="FormattedComment"> So the distro package of python3 may not include all the standard library... that came as quite the surprise. But yes, it makes sense from a distro package manager point of view. <br> <p> <font class="QuotedText">&gt; The good news is that the python3-full binary package now exists to meet this need. If you&#x27;re a Pythonista, you can install this and get the stdlib you expect</font><br> <font class="QuotedText">&gt; python3: The main CPython interpreter package, including the standard runtime stdlib.</font><br> <p> The difference between these two packages isn&#x27;t quite clear to me. <br> <p> Are there parts of the standard library absent from the python3 package in latest Debian? If so is there an easy way to find out the details? <br> <p> My experience has been that this is often under-documented - it can be quite hard to establish exactly how components are divided up between the various debian packages relating to a single large project. <br> </div> Wed, 01 Sep 2021 12:31:02 +0000 Cooperative package management for Python https://lwn.net/Articles/867971/ https://lwn.net/Articles/867971/ MrWim <div class="FormattedComment"> <font class="QuotedText">&gt; ensurepip never really made sense in a typical package-managed Linux distro. Distros have package-managers that are responsible for installing things. They don&#x27;t tend to get on well with other tools messing in the same trees of the filesystem.</font><br> <p> I think this is exactly why it makes sense to include venv wherever you include pip. venv is the mechanism that people use to avoid messing with the same trees of the filesystem. By not including it you have a pip that can mess with the distro provided packages, but you don&#x27;t have the capability to sandbox off these changes.<br> <p> Note: you don&#x27;t need to be a Python developer to want pip. You&#x27;ll need it whenever you want to run any non-distro-provided Python software - not only when developing it. It&#x27;s exactly these users who are not familiar with the Python packaging tools that are at most risk from breaking their systems in a way that they don&#x27;t know how to diagnose or fix.<br> </div> Wed, 01 Sep 2021 09:40:29 +0000 Cooperative package management for Python https://lwn.net/Articles/867966/ https://lwn.net/Articles/867966/ stefanor <div class="FormattedComment"> <font class="QuotedText">&gt; If you tell me that your operating system has &quot;Python&quot; on it, I am going to assume that I can use and call into every single part of the stdlib.</font><br> <p> The good news is that the python3-full binary package now exists to meet this need. If you&#x27;re a Pythonista, you can install this and get the stdlib you expect.<br> <p> But let&#x27;s dig deeper and questioning the assumption you made. Why do distros break it?<br> <p> There are some optional parts of the stdlib (e.g. database drivers), and then there are the mechanics of the operating system to consider.<br> <p> If an app in your operating system is written in Python, it is reasonable for that application to depend on a subset of the Python standard library, to reduce install footprint by minimizing dependencies. This may sound unreasonable at first, but there are things in the Python standard library that you really don&#x27;t need for app runtime: e.g. documentation, dev headers, stdlib test suite, Tkinter, IDLE, lib2to3, ensurepip, or distutils. As a Python developer, these may seem like sacrosanct parts of the stdlib, but as a distro maintainer, they are not something that you need to waste install CD space for, and most desktop end-users will never miss them. You can significantly reduce the installed size of the Python stack and its dependencies on most end-user systems by making these components optional.<br> <p> Generally distributions break complex packages up into multiple pieces, trying to find a balance between a minimal core and all the optional bits that users may need for their particular use case. (Not every optional feature will be supported, of course). In Debian, libreoffice is broken into around 200 binary packages, as an extreme example.<br> <p> Python in Debian is broken into several major pieces:<br> <p> python3: The main CPython interpreter package, including the standard runtime stdlib.<br> python3-minimal: Intended for install environments and size constrained CD images. Just the CPython interpreter + a minimalist subset of the stdlib.<br> python3-doc: Documentation.<br> python3-dev: C header files, the -config script, and a static version of libcpython.<br> python3-distutils: The distutils module (only needed at build time)<br> python3-examples: Examples, Demos and Tools<br> python3-dbg: A debug build of the CPython interpreter<br> python3-gdbm: The GNU dbm driver (and dependency on libgdbm)<br> python3-tk: tk module (and Tcl/Tk dependencies)<br> python3-venv: Depends on the wheels that ensurepip requires to bootstrap pip into a venv.<br> libpython3.X-testsuite: The stdlib test suite <br> idle-python-3.X: IDLE<br> Technically, there are a few more packages, but these are the functional break-points.<br> <p> <font class="QuotedText">&gt; The entire purpose of ensurepip was to *ensure* that everyone had pip available with every installation of Python, by incorporating it into the stdlib.</font><br> <p> And yet ensurepip never really made sense in a typical package-managed Linux distro. Distros have package-managers that are responsible for installing things. They don&#x27;t tend to get on well with other tools messing in the same trees of the filesystem. (That&#x27;s what this article is about.) Debian expects Debian users to install pip by apt installing python3-venv or python3-pip (as appropriate), not by running ensurepip to install things in /usr. For this reason Debian has always hobbled ensurepip to print an error message explaining this, when executed directly. When used by the venv module, it just does what you expect, and creates a venv seeded with pip.<br> </div> Wed, 01 Sep 2021 05:49:26 +0000 Cooperative package management for Python https://lwn.net/Articles/867964/ https://lwn.net/Articles/867964/ NYKevin <div class="FormattedComment"> As mentioned, both venv and ensurepip have programmatic interfaces and are part of the Python stdlib. If you tell me that your operating system has &quot;Python&quot; on it, I am going to assume that I can use and call into every single part of the stdlib. I&#x27;m not going to split out parts of the stdlib as separate dependencies, or instruct people to run distro-specific hacks to fix the half-an-installation they got by default. The entire purpose of ensurepip was to *ensure* that everyone had pip available with every installation of Python, by incorporating it into the stdlib. That&#x27;s why it&#x27;s called &quot;ensurepip,&quot; and not &quot;maybepip&quot; or &quot;optionalpip.&quot; By removing it, you are breaking API compatibility with standard (upstream) Python.<br> </div> Wed, 01 Sep 2021 04:13:22 +0000 Cooperative package management for Python https://lwn.net/Articles/867961/ https://lwn.net/Articles/867961/ JanC_ <div class="FormattedComment"> Based on the 2-3 sites I looked at, it seems like people were just missing a package, as they didn’t have venv (for the correct Python version) installed?<br> <p> There’s lots of other parts of “Python” that are not installed by default, e.g. development headers, documentation, tests, examples, IDLE, etc. Basically, a default install includes everything you need to run Python programs, but not everything you might need to develop in Python. I assume this is mostly to reduce its size in environments where all those aren’t needed (which is by far the majority of installations).<br> </div> Wed, 01 Sep 2021 00:57:46 +0000 Cooperative package management for Python https://lwn.net/Articles/867955/ https://lwn.net/Articles/867955/ NYKevin <div class="FormattedComment"> I have no idea if it&#x27;s still a problem today, but see for example <a href="https://www.google.com/search?q=debian+ensurepip+venv">https://www.google.com/search?q=debian+ensurepip+venv</a><br> <p> No really, click through. Look at the sheer *number* of people who were (or possibly still are?) inconvenienced by this behavior. I&#x27;m sure they had their reasons, but they broke a lot of workflows when they did that.<br> </div> Tue, 31 Aug 2021 22:42:21 +0000 Cooperative package management for Python https://lwn.net/Articles/867954/ https://lwn.net/Articles/867954/ beagnach <div class="FormattedComment"> What distros are in question here? How does the breakage manifest? <br> </div> Tue, 31 Aug 2021 22:01:20 +0000 Cooperative package management for Python https://lwn.net/Articles/867946/ https://lwn.net/Articles/867946/ NYKevin <div class="FormattedComment"> It&#x27;d be nice if I could depend on python3 -m venv actually working. It depends on ensurepip, which is or was sabotaged or outright removed by some distros because they didn&#x27;t want users to have a secondary package manager on their systems. The problem is that both ensurepip and venv have programmatic interfaces and are part of the Python standard library. You can&#x27;t just tear out random bits and pieces of a language&#x27;s stdlib. When I write code for &quot;Python,&quot; I expect the batteries to be included as advertised.<br> </div> Tue, 31 Aug 2021 21:03:45 +0000