Ask HN: Why does every package+module system become a Rube Goldberg machine?
Pythoners have themselves to blame.<p>The worst thing that happened to Python was that distributions like Red Hat not only shipped Python as an rpm but shipped system scripts in Python.  This made it practically impossible to upgrade the system Python without breaking scripts and is fundamentally incompatible with how Python packaging works.  (You are just one &#x27;sudo pip install&#x27; from breaking your system)<p>Like people who are impressed with ChatGPT (wow that answer seemed so confident even if it is wrong), Pythoners systematically mistake footguns for solutions.  For instance, use &#x27;pip install --user&#x27; and now the package you&#x27;ve included is visible when you type &#x27;python&#x27;,  &#x27;python3&#x27;, use a venv, conda, whatever.  I&#x27;ve had people tell me that having a &#x27;python3&#x27; is the best idea anyone&#x27;s had since Solomon proposed cutting a baby in half,  but if you stop and think you realize that pretty soon you have &#x27;python3&#x27;, &#x27;python3.5&#x27; (broken), &#x27;python3.6&#x27; (maybe broken), &#x27;python3.7&#x27;, &#x27;python3.8&#x27;, &#x27;python3.9&#x27;, ...<p>I would say venv&#x27;s really solve the problem with the exception that you can currently trash all your venv&#x27;s with &#x27;pip install --user&#x27;.<p>The trouble is that people who are bothered by this stop using Python,  the people who are still using Python are people who have difficulty perceiving the nature of the problem never mind that there is a problem.<p>The algorithm used by pip to resolve packages is not sound.  It goes off trying to install things and can only find out late in the game that it installed a package which is not compatible with another package.  This can be solidly blamed on the egg package format which can only determine the dependencies of a package when it tries to install it by running a setup.py.  This is nice because it can adapt to the environment dynamically (say add a timezone db on windows) but it is not like Java&#x27;s maven that knows it has a consistent solution before it downloads the JARs.<p>I&#x27;m pretty sure you could make a Python package manager that works like Maven if it only installed wheels because you can read the directory of a wheel (a ZIP file) with one or two http range requests and then read the dependency data with another http range request.  Poetry doesn&#x27;t quite do this.  Poetry does a lot better than pip does,  but whatever it does takes a really,  really,  really, long time.<p>Poetry might be the best thing going but it has the fundamental flaw of trying to be a 95% or 98% solution which,  to the Pythoner,  sounds like a good idea.  The trouble is that writing programs that are 98% is to computer science what Bigfoot is to zoology or ESP is to psychology.  The gap between that and 100% is not 2% but more like 200% because figuring out exactly what is wrong with the conceptual model and working around it in a hard case is at best like pushing a bubble under a rug.  Imagine how much trouble you could get into with a 98% correct sort or binary search algorithm...  It&#x27;s a place where professional developers just don&#x27;t want to go.<p>Java has the advantage of extreme xenophobia and bad feelings all around that mean that:  (1) people don&#x27;t expect to link very much C code into Java,  and (2) people don&#x27;t feel entitled to use the Java bundled with their Linux system and have it really work.  Because of (1),  Java code tends to be self-sufficient and avoids a whole sector of &#x27;dependency hell&#x27; involving .so and .dll files.  Because of (2) people feel both responsible and empowered to install a JDK that works unlike the typical who Pythoner doesn&#x27;t.<p>Don&#x27;t think that docker helps in any way,  what I found what that Docker accelerates the ability of Pythoner to find pythons that are broken in odd ways,  configured with strange default character sets and such.<p>Javascript has the nice feature that file A can import from package version B and file C can import from package version D so that the &#x27;diamond dependency&#x27; problems that are so terrible in Java (Like that bug in Guava post-13 that broke HDFS) and still problematic in Python rarely produce problems.  (You only have problems if an object from A migrates to C <i>and</i> it gets used in incompatible way,  contrast that to Java where probably the classloader blows up)<p>I was wishing over the weekend that Python had something like that because once more I have been building and packaging machine learning models for inference in Python and it would be really sweet to pack up a model that uses scikit-learn or pytorch or whatever into a Python package and then load it into a web server or a batch job.  It&#x27;s totally practical to do that,  using joblib to unpickle a few MB of code.  Once you end up needing two different versions of pytorch though,  you are really screwed.