-
-
Notifications
You must be signed in to change notification settings - Fork 419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
slow pdm lock example #2193
Comments
There's a backtrack on pystac. Resolution would probably be faster without all these upper bounds, which are probably coming from the translation of Poetry deps to PEP 621 deps. |
Latest sat-stac version, 0.4.1, still has |
Try to add this to pyproject.toml in the meantime: [tool.pdm.resolution.overrides]
python-dateutil = ">=2.7" (see the docs: https://pdm.fming.dev/latest/usage/config/#override-the-resolved-package-versions) IMO there's nothing more PDM can do here, so I'll close this issue! |
With a populated cache: % time pdm lock
🔒 Lock successful
Changes are written to pdm.lock.
pdm lock 59.23s user 1.94s system 57% cpu 1:46.25 total Under a minute 🎉 |
I don't use either pdm or stackstac so I'm not particularly invested in this, feel free to close it out. But I don't understand the point you're making. |
It is not a good solution: both pystac-client and pandas require version >= 2.8.
|
So the solver should find an earlier version of pystac-client, etc. (I have the poetry solution to hand, so if you want to know what answer it finds I can share that) |
The solver eventually does find versions that are compatible, and that's what is taking a long time. Or it doesn't, and it still takes a long time. There's not much PDM (or Poetry, or any other dependency solver) can do when libraries are indeed incompatible. |
I'll reopen for @frostming to take a look at this particular dependency tree and see if there's something wrong in the resolution that could be improved (in PDM or resolvelib). But that's a rather big tree, could be hard to investigate. |
A compatible solution does exist, but pdm is failing to find it in reasonable time. (I still don't know how long it takes, the command is still running). If you're OK with "eventually" then fair enough. But I'd think that fast is better than slow. |
Yes please! I'm curious now 🙂 |
Thanks! Well, the set of dependencies is indeed incompatible: the latest pandas which supports python-dateutil >=2.7.3 also supports Python 3.7, which is not supported in the main project here (stackstac, requiring python >= 3.8). The next version has a compatible Python requirement (>= 3.8), but an incompatible python-dateutil requirement (>=2.8.1). So there's no pandas version that is compatible with both Python 3.7 and python-dateutil ~=2.7.5. So PDM backtracks a lot, to find there's no solution. To fix this, stackstac should either support Python 3.7, or they should use the override as shown above, or sat-stac should publish a new version accepting python-dateutil>=2.7.5. Or maybe I got confused about the Python version compatibility? 🤔 |
Yes, I think you are confused. . While it's not impossible that the poetry solution is invalid - that project certainly has bugs! - it would be quite surprising. |
(Even if it is true that there is no solution, the bug report stands - then it would be desirable for pdm to be fast about proving that) |
Indeed, you're right, it's the other way around, I was confused, trying to solve dependencies in my head 😅 dependencies = [
"pystac",
"pystac-client",
"sat-stac",
"pandas",
] % pdm lock
🔒 Lock failed
Unable to find a resolution for pystac
because of the following conflicts:
pystac (from project)
pystac>=1.7.0 (from pystac-client@0.6.1)
To fix this, you could loosen the dependency version constraints in pyproject.toml. See https://pdm.fming.dev/latest/usage/dependency/#solve-the-locking-failure for more details.
See /tmp/pdm-lock-4y0w_ryv.log for detailed debug log.
[ResolutionImpossible]: Unable to find a resolution
Add '-v' to see the detailed traceback The final error message is not useful here, but it shows there's something wrong going on (either in the resolution itself or in the libraries compatibility). |
sounds like progress. poetry does find a solution to that set of requirements, so certainly (at least) one of pdm / poetry is wrong. The non-latest packages in poetry's solution are
|
Thanks for insisting 🙂 And thanks for the initial report. If I remove
So same as Poetry. Not sure why adding |
Maybe just an impression but it looks like when I specify Pinning |
dependencies = [
"pandas",
"pystac",
"pystac-client",
"sat-stac>=0.4",
] % pdm lock -v 2>&1 | grep -Eo 'from pandas[@ ][^)]+' | sort -u
from pandas 1.3.5
from pandas@1.3.5
from pandas 1.4.0
from pandas 1.4.1
from pandas 1.4.2
from pandas 1.4.3
from pandas 1.4.4
from pandas 1.5.0
from pandas 1.5.1
from pandas 1.5.2
from pandas 1.5.3
from pandas 2.0.0
from pandas 2.0.1
from pandas 2.0.2
from pandas 2.0.3 dependencies = [
"pandas",
"pystac",
"pystac-client",
"sat-stac",
] % pdm lock -v 2>&1 | grep -Eo 'from pandas[@ ][^)]+' | sort -u
from pandas 2.0.3
from pandas@2.0.3 Looks like a backtracking limitation (to avoid combinatorial explosion?). Out of my depth here 😕 |
There are cases where improper dependency set causes the resolver to track too deep and become significantly slower. In this case, But if the resolver fails to resolve some dependencies that becomes successful after making the range more specific, this would be a bug. Footnotes
|
yes, that's where we got to. The thread got a bit long but the course it has taken is
I guess it's plausible that if you fix the bug associated with the second set of requirements, then the failure-to-reach-any-decision of the original report may also go away. |
BTW, you can always manually optimize the resolution to avoid it into an error branch at the beginning. In this case, you can set |
Thanks, but I don't need workarounds. I'm reporting this just as a good citizen rather than because I care about a solution. As I mentioned earlier, I actually was looking for examples where poetry behaved badly and it's just chance that I instead found one where pdm behaves badly. Letting you know about it seemed like the right thing to do. (I guess it's possible that someone who does care about stackstac will show up and then they'll appreciate workarounds being available) |
Hey all, I'm a standard user of pdm. Personally, I find the slowness irritating at times but I always assume it's because of a complex resolution scheme at some point. What bothers me more is the lack of feedback, you get no idea of where the processing is at nor if there is anything you could do to improve it. |
Well, the resolution failure can be also observed on pip using the following requirements.txt:
It seems the So it is a certain issue with |
Make sure you run commands with
-v
flag before pasting the output.Steps to reproduce
Actual behavior
I actually don't know how long this takes - it has been about forty minutes so far. But it's a long time.
Expected behavior
Faster locking.
Environment Information
I actually found this one by looking for examples of poetry being slow, in the hope of finding something interesting that could be improved there. stackstac switched from poetry to pdm "because Poetry was taking multiple hours to lock dependencies".
However today it seems to be pdm that is taking a considerable time to lock dependencies, so I thought you might appreciate the example.
The text was updated successfully, but these errors were encountered: