question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dependency resolution takes awfully long time

See original GitHub issue
  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: macOS Big Sur

  • Poetry version: 1.1.13

  • Link of a Gist with the contents of your pyproject.toml file: I can provide upon request.

Issue

Version resolution in our moderately large (25 immediate dependencies) project is taking too long. For me it is about 200-250 seconds each time, and my colleagues have reported times even up to 1000 seconds.

A common scenario in this project is to update version constraint on one of the dependencies or add a new one, and then run poetry lock --no-update. It seems that the algorithm behind this command is not optimal in our case.

I will try to describe what I see in verbose (-vvv) output. Full output may be found here: https://gist.github.com/maksbotan/a72f5d801e8515b74a9f0ab7fbcef321

This concrete run had no changes in pyproject.toml and took 220 seconds anyway. As far as I see, poetry tries different solutions with different version of numpy, even if numpy version is not changed:

   0: Duplicate dependencies for numpy
   0: Different requirements found for numpy (>=1.18.5) with markers platform_machine != "aarch64" and platform_machine != "arm64" and python_version < "3.10", numpy (>=1.19.2) with markers platform_machine == "aarch64" and python_version < "3.10" and numpy (>=1.20.0) with markers platform_machine == "arm64" and python_version < "3.10".
   1: Version solving took 19.610 seconds.
   1: Tried 1 solutions.
   0: Retrying dependency resolution with the following overrides ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}}).
...
   1: Version solving took 72.396 seconds.
   1: Tried 1 solutions.
   0: Retrying dependency resolution with the following overrides ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}}).
...
   1: Version solving took 67.490 seconds.
   1: Tried 1 solutions.
   0: Retrying dependency resolution with the following overrides ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}}).
   1: Version solving took 60.766 seconds.
   1: Tried 1 solutions.
   0: Complete version solving took 220.588 seconds with 3 overrides
   0: Resolved with overrides: ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.18.5)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.19.2)>}}), ({Package('pandas', '1.4.0'): {'numpy': <Dependency numpy (>=1.20.0)>}})

I do not understand why poetry needs to retry different numpy constraints, especially when nothing changed in that regard, and why it comes up with three overrides for it with intervals that can be simplified to one. For the record, resolved version of numpy is 1.21.4.

Also, this may be related: looks like poetry tries to query global PyPI for information about packages from our private repo, even though they have [package.source] section in poetry.lock. From log:

PyPI: Getting info for humanizator (0.4.9) from PyPI
PyPI: Getting info for humanizator (0.4.9) from PyPI
PyPI: Getting info for pandorabox (0.4.21) from PyPI
PyPI: Getting info for oneq (1.11.2) from PyPI
PyPI: Getting info for pandorabox (0.4.21) from PyPI
PyPI: Getting info for humanizator (0.4.9) from PyPI
PyPI: Getting info for pandorabox (0.4.21) from PyPI
PyPI: Getting info for oneq (1.11.2) from PyPI
PyPI: Getting info for pandorabox (0.4.21) from PyPI
PyPI: Getting info for humanizator (0.4.9) from PyPI
PyPI: Getting info for pandorabox (0.4.21) from PyPI
PyPI: Getting info for oneq (1.11.2) from PyPI
PyPI: Getting info for pandorabox (0.4.21) from PyPI

Thanks in advance!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:10
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
john-sandallcommented, Feb 19, 2022

For those hitting this, I added a couple tips on this issue on how to improve issues with Poetry being slow: https://github.com/python-poetry/poetry/issues/2094#issuecomment-1045991952

1reaction
eekcoopuwcommented, Feb 15, 2022

Also looks related to #5121. Note the “retries” name various combinations of versions of pandas and numpy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependency resolution takes huge amount of time - Old Forum
My build is taking a huge amount of time. The problem is that gradle is stuck on dependency resolution. The same build with...
Read more >
pip's dependency resolver takes way too long to solve the ...
INFO: pip is looking at multiple versions of <Python from requires-Python> to determine which version is compatible with other requirements.
Read more >
Gradle import is very slow in multi-module projects due to ...
For large multi-module projects with many external repositories these unsuccessful HTTP calls can take a long time, on the order of many minutes....
Read more >
474881 – Resolving dependencies of MavenProject ... - Bugs
I run a Maven Tycho build for an individual test plug-in and the dependencies resolve phase feels very long for its little dependencies....
Read more >
MUnit 2.1.5 run in Studio 4.2.0 CE throws dependency ...
MUnit 2.1.5 run in Studio 4.2.0 CE throws dependency resolution failure for ... It seems that the MUnit/Community problem is persistent for very...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found