Live data from Hacker News

New Pip resolver takes a long time to complete

github.com

11–20 of 45 posts

Re: New Pip resolver takes a long time to complete

#11
I used to think package managers and dependency resolvers were inseperable, I even did a little bit of work on the APT resolver.

Since using GNU Guix though, I'm so glad it doesn't have a dependency resolver as part of building or installing packages! It's so much better for it, no slow or unpredictable resolving, you know what it's going to do.

I think this is one reason why I've never used pip for managing Python software, I've only ever used Debian, and then Guix.

Re: New Pip resolver takes a long time to complete

#12
Did I get it right, the problem is basically that the dependency info is turing complete and decided "at installtime", thus the dependency graph cannot be computed without installing many versions of all dependencies? (I do not use python, so I don't know much about how pip works)

Are there other languages that have dependencies decided at installtime?

Re: New Pip resolver takes a long time to complete

#13

Did I get it right, the problem is basically that the dependency info is turing complete and decided "at installtime", thus the dependency graph cannot be computed without installing many versions of all dependencies? (I do not use python, so I don't know much about how pip works) Are there other languages that have dependencies decided at installtime?

> dependency info is turing complete

It's NP-complete in general I think, definitely the case in Haskell-land. I think OCaml sets an explicit timeout for dependency resolution?

> the dependency graph cannot be computed without installing many versions of all dependencies?

Does PyPi not have an index or something? (with statically known package bounds?)

Re: New Pip resolver takes a long time to complete

#14

Did I get it right, the problem is basically that the dependency info is turing complete and decided "at installtime", thus the dependency graph cannot be computed without installing many versions of all dependencies? (I do not use python, so I don't know much about how pip works) Are there other languages that have dependencies decided at installtime?

Most distros have install time dependency resolution, such as yum/dnf using libsolv. Repos are a collection of packages alongside metadata tables containing package versions and their dependencies. The tables get cached locally and are used to resolve dependencies prior to downloading any actual RPMs.

Re: New Pip resolver takes a long time to complete

#15
post #9

They need to store the version requirements metadata outside the packages. Having to download the entire wheel just to see whether it is compatible is ridiculous. This could all be computed by downloading an index file, then performing the resolution. They made a half-assed attempt when pypa/pip added the "data-requires-python" tag, but that covers python interpreter version only, it needed to have been done for all…

This is the subject of discussion in this Warehouse (the PyPI backend) issue[1].

The TL;DR is that it probably requires a PEP.

FD: I've been working on adjacent features in PyPI.

[1]: https://github.com/pypa/warehouse/issues/8254

Re: New Pip resolver takes a long time to complete

#16

Earlier quoted context omitted.

I think that will be proven before python fixes their package management.

At least they are trying to fix it, vs other languages where there are literally no paths forward. IMO python has one of the more mature packaging ecosystems out there at this point. It is so incredibly easy.

>IMO Python has one of the more mature packaging ecosystems out there

Ouch, what languages are you using where this is true? For example, JS / NPM / Yarn are absolutely blowing pip out of the water. I guess I can imagine Java or C++ users having your perspective though

Re: New Pip resolver takes a long time to complete

#17
post #11

I used to think package managers and dependency resolvers were inseperable, I even did a little bit of work on the APT resolver. Since using GNU Guix though, I'm so glad it doesn't have a dependency resolver as part of building or installing packages! It's so much better for it, no slow or unpredictable resolving, you know what it's going to do. I think this is one reason why I've never used pip for managing Python s…

Wait, how does guix avoid a dependency resolver? It still has dependencies for packages... are they just hardcoding exact dependencies (including versions) and relying on the "can install multiple versions of a package" property to make that work? That seems inefficient, though I guess maybe they need that for the "this hash means this exact binary" outcome?

Re: New Pip resolver takes a long time to complete

#18

Did I get it right, the problem is basically that the dependency info is turing complete and decided "at installtime", thus the dependency graph cannot be computed without installing many versions of all dependencies? (I do not use python, so I don't know much about how pip works) Are there other languages that have dependencies decided at installtime?

Right, for packages distributed as source (vs. having prebuild "binary wheels") the dependencies are specified in python code. Example from one comment on the bug:

  setup(
    install_requires=[random.choice(["urllib3", "requests"])]
  )
This example wouldn't make any sense, but you could imagine installing different dependencies for x86 CPUs or something via a runtime check, and there are lots of packages that use this for checking python versions even though there's now a static way to do that.

So that leads to this situation, from another comment:

"And as an example, [the botocore package, which has releases nearly daily] depends on python-dateutil>=2.1,Sounds like there's a long term plan that could fix this situation. Binary wheels already have the needed metadata in a way that could be exposed by PyPI via a fast "fetch dependency constraints for all versions" API, but isn't yet. And for source dists there's a very new plan ( https://www.python.org/dev/peps/pep-0643/ ) to let them indicate that they don't modify install_requires at runtime, so their deps could also be exposed via API, but the ecosystem will have to catch up with that.

I dunno what pip does in the meantime, though!

(I'm a python dev but haven't followed this beyond skimming the bug, so I hope I'm getting this right.)

Re: New Pip resolver takes a long time to complete

#19
post #9

They need to store the version requirements metadata outside the packages. Having to download the entire wheel just to see whether it is compatible is ridiculous. This could all be computed by downloading an index file, then performing the resolution. They made a half-assed attempt when pypa/pip added the "data-requires-python" tag, but that covers python interpreter version only, it needed to have been done for all…

[deleted]

Re: New Pip resolver takes a long time to complete

#20
post #9

They need to store the version requirements metadata outside the packages. Having to download the entire wheel just to see whether it is compatible is ridiculous. This could all be computed by downloading an index file, then performing the resolution. They made a half-assed attempt when pypa/pip added the "data-requires-python" tag, but that covers python interpreter version only, it needed to have been done for all…

yeah, why not just use libsolv or something?
Post reply on HN