LWN: Comments on "A survey of the Python packaging landscape" https://lwn.net/Articles/920132/ This is a special feed containing comments posted to the individual LWN article titled "A survey of the Python packaging landscape". en-us Fri, 26 Sep 2025 15:17:43 +0000 Fri, 26 Sep 2025 15:17:43 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net A survey of the Python packaging landscape https://lwn.net/Articles/921305/ https://lwn.net/Articles/921305/ callegar <div class="FormattedComment"> <span class="QuotedText">&gt; [...] there can be conflicting dependency needs between different packages or applications. If application A needs version 1 of a dependency, but application B needs version 2, only one can be satisfied because only a single version of a package can be active for a particular Python instance. </span><br> <p> <span class="QuotedText">&gt; It is not possible to specify that the import statement in A picks up a different version than the one that B picks up.</span><br> <p> Regardless of solutions to other more difficult problems, such as the management of "native" dependencies, the point above keeps puzzling me, since it seems addressable and still does not seem to enjoy large consideration. On one hand it gets mentioned only with regards to pip, but it is in fact common to all the mentioned packaging options (pip, setuptools, or conda) and it does not go away (not completely at least) even if you use virtual environments.<br> <p> The main problem is that it gives a huge power to a single author to make a whole ecosystem lag. If you have a project and in your project there is a single dependency X whose author is not prompt (or even not willing) to update its own dependency requirements then that single X is going to prevent you from using up to date versions of all its dependencies that may be themselves dependency of your project. In turn these older packages will impose limits on how new their own dependencies can be, until all your project ends up having to rely on old stuff, giving up on the opportunity to use new features. Using a virtual environment here does not help. <br> </div> Thu, 26 Jan 2023 13:35:23 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/921299/ https://lwn.net/Articles/921299/ sammythesnake <div class="FormattedComment"> I also had an unconscious assumption about why it was called that. "Don't reinvent the wheel" - don't recompile what somebody else has already compiled...<br> </div> Thu, 26 Jan 2023 11:46:31 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/921285/ https://lwn.net/Articles/921285/ milesrout <div class="FormattedComment"> It's far from meaningless. How do you reach that conclusion? The solution is really very simple and is covered in the first few paragraphs of this article.<br> </div> Thu, 26 Jan 2023 09:07:40 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/921280/ https://lwn.net/Articles/921280/ njs <div class="FormattedComment"> Heh. You'll probably find this thread interesting, then: <a rel="nofollow" href="https://discuss.python.org/t/announce-pybi-and-posy/23021">https://discuss.python.org/t/announce-pybi-and-posy/23021</a><br> </div> Thu, 26 Jan 2023 06:20:04 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920727/ https://lwn.net/Articles/920727/ CChittleborough I always assumed the <a href="http://www.catb.org/jargon/html/W/wheel.html">old hacker jargon term “wheel”</a> had something to do with it. Hmm... Sun, 22 Jan 2023 08:25:34 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920568/ https://lwn.net/Articles/920568/ NYKevin <div class="FormattedComment"> Well, there is pyproject.toml, but that only has build requirements, not install requirements. There's also setup.cfg, but as far as I can see, that's only providing *defaults* that can be overridden in setup.py.<br> <p> I think the "standard" solution to this problem is pip freeze, but while this does solve the "I have a setup that works, now how do I replicate it?" problem, it does *not* solve the "I have a setup that works, but it's outdated, now how do I build a newer setup that also works?" problem, and that's arguably the more important problem to solve.<br> </div> Fri, 20 Jan 2023 00:32:56 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920569/ https://lwn.net/Articles/920569/ iabervon <div class="FormattedComment"> It's the common pattern where the first attempt is clunky but works, and the next N attempts are not clunky but don't work, and they eventually reach something that can express everything necessary nicely (but you never know whether they're there yet). They eventually deprecate the first thing when they stop finding problems with each newest thing; meanwhile, people just don't migrate off of the first thing, which has always worked and never been deprecated.<br> <p> For what it's worth, objects that fit the duck type of pathlib.Path as far as any operations you'd want to attempt are really nice to work with, although I wouldn't be annotating any variables with the current return type of importlib.resources.files().<br> <p> </div> Thu, 19 Jan 2023 23:57:09 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920566/ https://lwn.net/Articles/920566/ NYKevin <div class="FormattedComment"> Aha, I found it: <a href="https://github.com/python/cpython/issues/89838">https://github.com/python/cpython/issues/89838</a><br> <p> <span class="QuotedText">&gt; FYI the long-term plan is to deprecate pkgutil, so I would use newer APIs as provided by importlib.</span><br> <p> So it's to-be-deprecated but not actually deprecated yet. And the churn continues...<br> </div> Thu, 19 Jan 2023 23:27:43 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920536/ https://lwn.net/Articles/920536/ acarno <div class="FormattedComment"> I wonder if there will come a day when Randall decides to go entirely meta and creates a comic that references the fact that there's _always_ a relevant xkcd.<br> <p> Thanks for sharing! :)<br> </div> Thu, 19 Jan 2023 18:33:25 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920437/ https://lwn.net/Articles/920437/ ehiggs <div class="FormattedComment"> The fundamental issue as far as I can see is that Python tooling cannot be written in Python because you end up with a bootstrap problem: python depending on [another] Python at runtime. And often people get confused and end up bootstrapping using a single Python - which gives a whole host of other potential problems when the package management stuff depends on a different version of a library than the application.<br> <p> To wit: pyenv is written in shell scripts and while it's a bit janky, it works very well because it doesn't suffer from this bootstrap problem.<br> <p> I would recommend Rust for this but someone will just end up writing plugins in PyO3 and reintroduce the boostrap problem again - so it would need something with no (or unpopular) Python bindings. The obvious conclusion: Python tooling should be written in Go.<br> </div> Thu, 19 Jan 2023 12:48:18 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920434/ https://lwn.net/Articles/920434/ zorro <div class="FormattedComment"> You were right, it does not work because of the hardcoded absolute paths. <br> <p> I ended up following the Windows embeddable package approach described in <a href="https://fpim.github.io/posts/setting-up-python-windows-embeddable-environment-properly">https://fpim.github.io/posts/setting-up-python-windows-em...</a>. This gave me exactly what I wanted. No system-level installation of Python, all dependencies contained in a single folder (including Python itself), an no hardcoded absolute paths. Better than using venv, AFAIC.<br> <p> </div> Thu, 19 Jan 2023 12:05:37 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920288/ https://lwn.net/Articles/920288/ kleptog <div class="FormattedComment"> <span class="QuotedText">&gt; 4. A venv is basically the world's leakiest userspace container, which is to say that venvs are really not containers at all, but just a bunch of scripts and environment variables that ask Python nicely to pretend that it's running in an isolated environment. Deploying a venv in production "as is" is questionable at best. You're probably better off using real containers instead, at which point the venv is redundant.</span><br> <p> Yeah, venvs are fine for development, but for production we use a two stage docker build process that first takes the list of dependencies and produces a bunch of wheels, and then builds a clean docker image with all the wheels installed globally.<br> <p> The biggest weakness IMHO of pip is that PyPI has no metadata file, so it has to actually download the package (and possibly executes the setup.py) to determine the dependencies. So the package resolver, if it gets into an unresolvable situation, can keep downloading older and older versions in an attempt to make it work. One time we got strange errors from the buildbot and figured it had downloaded 3 year old versions of various packages which somehow worked (and had taken all night to do it).<br> </div> Thu, 19 Jan 2023 09:20:53 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920416/ https://lwn.net/Articles/920416/ marcH <div class="FormattedComment"> <span class="QuotedText">&gt; That is typically done using the pip package installer, which will either install the package in a site-wide location or somewhere user-specific depending on whether it was invoked with privileges. pip will also download any needed dependencies, but it only looks for those dependencies at PyPI, since it has no knowledge of the distribution package manager. That can lead to pip installing a dependency that actually is available in the distribution's repository,</span><br> <p> My super ugly way to work around this issue has been to go and try "apt-get/dnf install python[3]-X" where X is the pip name. It works about 80% of the time.<br> <p> pip install finally added some "--dry-run" flag that helps with that.<br> <p> It would be nice for Linux distros to make that mapping easier. Maybe packages that don't follow that naming convention could have a "python-X" alias when possible. It does not have to work 100% of the time, going from 80% to 95% would already help a lot.<br> <p> <p> </div> Thu, 19 Jan 2023 05:11:57 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920410/ https://lwn.net/Articles/920410/ ranger207 <div class="FormattedComment"> There is, in fact, an even more relevant xkcd:<br> <a href="https://xkcd.com/1987/">https://xkcd.com/1987/</a><br> </div> Thu, 19 Jan 2023 03:22:41 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920404/ https://lwn.net/Articles/920404/ NYKevin <div class="FormattedComment"> Part of the problem is that there has been significant rearranging of the deck chairs for "how do I avoid tying everything to files and directories that really exist in the filesystem?" In the bad old days, you basically couldn't, because a package might embed some data file inside of itself, and try to consult it at runtime (using __file__ to figure out where it was). There was nothing forbidding this, so such packages were simply broken if you tried to install them as anything other than a bunch of actual files and directories that were really mounted somewhere in the filesystem. Over time, various APIs emerged that would "do that, but also DTRT if the package isn't materialized on disk," and were then deprecated in favor of the next API. I'm aware of at least the following:<br> <p> * pkgutil.get_data(package, path)<br> * pkg_resources, generally<br> * importlib.resources.read_text() etc.<br> * importlib.resources.files(package) and all of the various methods you can call on its return value<br> <p> Of these, pkgutil and importlib.resources.files() are not explicitly marked deprecated, and both are in the stdlib, so obviously we're supposed to... flip a coin? Well, pkgutil has a much simpler API, so it's probably the one that people will use in practice, but importlib.resources is far newer (despite already having a significant portion of its API surface marked as deprecated), so it's probably the one that they *want* people to use.<br> </div> Thu, 19 Jan 2023 01:38:32 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920405/ https://lwn.net/Articles/920405/ pj <div class="FormattedComment"> My python management:<br> 1. python versioning via nix (as a non-main package manager on my ubuntu system)<br> 2. python dependency version pinning via pip-tools<br> <br> but then I still use setup.py and bdist_wheel for packaging.<br> </div> Thu, 19 Jan 2023 01:34:49 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920382/ https://lwn.net/Articles/920382/ iabervon <div class="FormattedComment"> I think what's missing is something built into Python that's like Gentoo's python-exec (but more extensive): an executable that encodes an environment and runs a script in that environment. I think venv is kind of like having the dynamic linker support library paths and sonames (more than like containers), but there's no data format for representing the linker instructions and being able to stick the platform's executable glue on it. There are a bunch of good components for having a script running with the correct versions of packages ready to load, but there's nothing standard for making an executable that starts a script in exactly the state that's going to work and not some other state.<br> </div> Wed, 18 Jan 2023 20:45:03 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920369/ https://lwn.net/Articles/920369/ NYKevin <div class="FormattedComment"> I think we are using the word "isolation" to mean different things. To my mind, a venv provides *some* isolation, because you can have more than one, and install different packages (or different versions of the same package) into each venv. A container provides that benefit, but it also isolates non-Python things such as libc.<br> <p> I am not familiar with your definition of "isolation."<br> </div> Wed, 18 Jan 2023 18:11:34 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920359/ https://lwn.net/Articles/920359/ mathstuf <div class="FormattedComment"> AFAIK, venvs bake in their path (e.g., shebang lines at the top of scripts), so relocatability isn't a property they have.<br> <p> FWIW, this means that "activating" a venv is never actually necessary. At least I never do it. Instead, I just run the `pip`, `python`, or any other tool directly from the venv directory and everything Just Works™.<br> </div> Wed, 18 Jan 2023 16:32:09 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920357/ https://lwn.net/Articles/920357/ Wol <div class="FormattedComment"> You probably are.<br> <p> Okay, I run gentoo, and I installed Sphinx as per the instructions (use venv, I think it said). I'm not a Python user, I don't understand it, and very quickly all hell broke lose.<br> <p> At which point, I realised that gentoo has a Sphinx package, I installed that instead, and now everything appears to work fine.<br> <p> The problem, as it appears to me, is that if you are dealing with a clueless luser (which is me and Python), venv is both hard to automate, and hard to explain. BOOM! Now I leave everything to emerge, it's not a problem. "It Just Works (tm)".<br> <p> Cheers,<br> Wol<br> </div> Wed, 18 Jan 2023 15:26:18 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920328/ https://lwn.net/Articles/920328/ SnoopJ <div class="FormattedComment"> Uptake of PEP 668 by distributions would probably alleviate some of the headaches, but not really the ones being addressed in Chris Warrick's post.<br> <p> Mostly it would prevent users from damaging their distribution copy by giving distributions with strong opinions about How Python Should Be the option to tell pip (or other package managers) that the site is someone else's problem.<br> </div> Wed, 18 Jan 2023 14:27:10 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920326/ https://lwn.net/Articles/920326/ jhoblitt <div class="FormattedComment"> I believe it is progress in that there seems to finally be some maintainer level exceptance of the severity of the python packaging problems.<br> <p> The scientific computing world has heavily embraced conda, which solves somes of the issues but it is still messy to try use two tools at the same time with conflicting dependency chains. <br> </div> Wed, 18 Jan 2023 14:18:24 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920327/ https://lwn.net/Articles/920327/ rahulsundaram <div class="FormattedComment"> <span class="QuotedText">&gt; Thanks to this article I now know what a "wheel" is in the Python context (I think), but I'm still not clear why they are called that. How do you get from "pre-compiled Python extension" to "wheel"?</span><br> <p> Interesting question. Apparently it is a bit of an inside joke. Refer to <br> <p> <a href="https://discuss.python.org/t/where-the-name-wheel-comes-from/6708/3">https://discuss.python.org/t/where-the-name-wheel-comes-f...</a><br> <p> More about the wheel format in <a href="https://peps.python.org/pep-0427/">https://peps.python.org/pep-0427/</a><br> </div> Wed, 18 Jan 2023 14:15:51 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920295/ https://lwn.net/Articles/920295/ jkingweb <div class="FormattedComment"> Thanks to this article I now know what a "wheel" is in the Python context (I think), but I'm still not clear why they are called that. How do you get from "pre-compiled Python extension" to "wheel"?<br> </div> Wed, 18 Jan 2023 13:56:38 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920293/ https://lwn.net/Articles/920293/ zorro <div class="FormattedComment"> <span class="QuotedText">&gt; You're probably better off using real containers instead, at which point the venv is redundant.</span><br> <p> I'm on Windows and what I want to do is ZIP the contents of my venv folder and use the resulting ZIP file as a distribution package for my application. My hope is that I can simply unzip the package on any other Windows computer and run the application there without needing to install or cause interference with anything, including Python itself. Am I too optimistic?<br> <p> <p> </div> Wed, 18 Jan 2023 13:45:20 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920287/ https://lwn.net/Articles/920287/ cyperpunks <div class="FormattedComment"> Due to this mess, it's meaningless to recommended to use Python for projects that have multiple platforms as targets.<br> <p> It's often more work to deploy a Python application than maintaining the actual Python code.<br> <p> </div> Wed, 18 Jan 2023 09:46:29 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920285/ https://lwn.net/Articles/920285/ LtWorf <div class="FormattedComment"> <span class="QuotedText">&gt; A venv is basically the world's leakiest userspace container</span><br> <p> I don't understnad. A venv is not there to provide isolation. It's there to basically provide a path to use to load libraries. That's all. It's a completely different thing than a container.<br> <p> Also, most containers, by default, do not provide any isolation.<br> </div> Wed, 18 Jan 2023 06:52:27 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920284/ https://lwn.net/Articles/920284/ k8to <div class="FormattedComment"> I have wasted so much 'devops' time trying to figure out why certain python encryption modules just didn't build on some environments. For some reason it seems much more fragile than building things from source in C ever used to be. Maybe just because the feedback experience is bad, and with modern 'install every time' approaches, it fails in the middle of automation rather than interactively.<br> <p> It feels like there probably is some middle path of cooperation between the distribution and python that could make this less brittle for the common culrpits. But maybe not.<br> </div> Wed, 18 Jan 2023 06:36:37 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920282/ https://lwn.net/Articles/920282/ NYKevin <div class="FormattedComment"> It depends on what you mean by "Just Do It." For certain values of "Just Do It," pip and venv are already in the box and can already Just Do It.<br> <p> Having said that, they're far from perfect. Problems with pip and venv:<br> <p> 0. You have to create the venv. It doesn't just magically spring into existence when you start installing packages, or prompt you to create it, or something of that nature. (It would probably still be good to have a way to do manual venv creation, but the fact that it's not automatic means that less experienced users will not realize they need to do it in the first place.)<br> 1. pip still wants to install into the global site-packages dir by default (i.e. if no flags are passed and a venv is not active). This is bad. pip should not do that, at least not without some kind of --i-know-what-im-doing flag. It baffles me that the Python folks are dragging their feet on this one - I could've told you that five years ago. To be fair, this is not a totally unreasonable thing to do on platforms with no package manager (i.e. Windows), but even so it's still not ideal for development purposes, and end users probably should not be using pip anyway.<br> 2. pip's handling of dependency management and versioning is rather minimal, and possibly inadequate for some situations.<br> 3. More generally, pip and venv are slightly less abstract than what some users (i.e. academics and other non-software-engineers) would like them to be. They are not opinionated enough, and where they do have opinions, those opinions are sometimes the "wrong" ones (for the scientific use case in particular).<br> 4. A venv is basically the world's leakiest userspace container, which is to say that venvs are really not containers at all, but just a bunch of scripts and environment variables that ask Python nicely to pretend that it's running in an isolated environment. Deploying a venv in production "as is" is questionable at best. You're probably better off using real containers instead, at which point the venv is redundant.<br> 5. If you don't have a C compiler all set up and ready for pip to invoke, then some packages simply can't be installed (by pip), because they are not distributed as compiled binaries and/or because distributing binaries on Linux is generally awkward.<br> 6. Several Linux distributions, notably including Debian and its derivatives, have intentionally sabotaged pip and (indirectly) venv to prevent problem (1) from breaking people's systems. On those systems, you have to install pip separately, even though upstream distributes it as part of the language. This leads to confusion and the perception of pip and venv as "not ready for general use" (e.g. "the tutorial said to run python -m venv env, but when I do that, it gives this weird error about pip and says it isn't going to work!").<br> 7. There are probably at least a few domain-specific problems that I'm unaware of, but the above is just what I could think of off the top of my head.<br> </div> Wed, 18 Jan 2023 05:03:50 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920283/ https://lwn.net/Articles/920283/ PengZheng <div class="FormattedComment"> <span class="QuotedText">&gt; But wheels are highly specialized for the operating system, architecture, C library, and other characteristics of the environment, which leads to a huge matrix of possibilities. PyPI relies on all of the individual projects to build "all" of the wheels that users might need, which distributes the burden, but also means that there are gaps for projects that do not have the resources of a large build farm to create wheels. Beyond that, some Python applications and libraries, especially in the scientific-computing world, depend on external libraries of various sorts, which are also needed on target systems.</span><br> <p> I think it is plausible to combine C/C++ package manager (yes, I mean Conan, which is also written in python) with pip and virtualenv, and let Conan deal with these external libraries.<br> </div> Wed, 18 Jan 2023 05:00:24 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920277/ https://lwn.net/Articles/920277/ tialaramex <div class="FormattedComment"> Surely shipping it in the box with Python would be almost exactly like Cargo ?<br> <p> If there's a tool that's right in the box and is at least pretty good for beginners, then why would they use something else at first while learning? And once all the beginners use it, you're starting to build up a population who want this tool even if maybe an alternative could be better for some things, they've "grown up" with the bundled tool and that's what they want improved.<br> <p> If Python shipped with a tool that can "Just Do It" when it comes to using modules like Requests, whatever the popular way is to talk to Postgressql or MariaDB or whatever, maybe a couple of popular options for Machine Learning or AWS S3 or other stuff some people need a lot but others don't, that could be huge even if it can't install Bob's Third Mediocre JSON parser v0.1.2 or whatever.<br> </div> Wed, 18 Jan 2023 01:47:21 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920276/ https://lwn.net/Articles/920276/ hazmat <div class="FormattedComment"> fwiw, i'm currently using the same setup, imho its pretty decent given the state of the ecosystem, i still find myself occasionally reaching to pip to install a one off tool (pipdeptree, etc ie in venv tree) or pipx for system tools. i wish some of this discussion had actually discussed supply chain security aspects, the tuf pypi integration is forever long :/ <br> </div> Wed, 18 Jan 2023 01:08:39 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920275/ https://lwn.net/Articles/920275/ acarno <div class="FormattedComment"> Given the current fragmentation, I suspect any attempt by PyPA to unify the current ecosystem would look akin to <a href="https://xkcd.com/927/">https://xkcd.com/927/</a> . And with no language-defined means to enforce it (such as a cargo-like solution), I think it would take a major rev of the language (e.g., the mythical "Python 4") to do so.<br> </div> Wed, 18 Jan 2023 00:53:55 +0000 A survey of the Python packaging landscape https://lwn.net/Articles/920269/ https://lwn.net/Articles/920269/ ryanduve <div class="FormattedComment"> Here's my current Python environment management:<br> <p> 1. Pyenv, to manage installation of different Python versions. From what I can tell, it's the equivalent of building Python from source, but it takes care of the common build flags and does free namespace management. I used to use the system package manager for this, but Pyenv supports every minor/patch version of Python I've thrown at it, which is really useful.<br> <p> 2. Poetry, to manage dependencies for each project and generate a lock file, which nails down transitive dependency versions.<br> <p> <p> System-level dependencies are usually just sort of agreed upon within the working group, which works because they rarely need formal specification for our work. If that's not the case, we replace Pyenv with a Docker image and specify whatever is needed on top from there.<br> <p> <p> It's honestly not ideal. There's a ton of `poetry env remove ...` voodoo that has to be done from time-to-time, and it's always a headache determining which virtual environment is active on someone else's IDE. I hope the PyPA comes up with a single replacement for both the above, packaged with Python's standard library.<br> </div> Tue, 17 Jan 2023 23:51:33 +0000