You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Poetry is extremely slow when resolving the dependencies #2094
Could this be due to downloading packages from pypi to inspect their dependencies, when not properly specified?
It seems so. I have checked the detailed log, poetry kept retrying to resolve the dependency for botocore, but without success. So I assume that the dependency can be eventually resolved if enough time is given.
However, is there any way to get around this?
BTW, I also consider it's better to give some warning if there are some dependencies are not properly specified and could not be resolved after a number of attempts.
Reacted by Maciej (MJ) Mikulski, Vladimir Lar’kin, Farhan Hai Khan, aviad priel, Raphael Das Gupta, Aizen M, megan-carey, Temi Babs, Erik Bjäreholt, William Leighton Dawson and 5 more
I encounter a similiar problem on my MacOS. Python version used is 3.7.6, Poetry is 1.0.5. I just created a new project with no dependencies so far in pyproject.toml, just initially pytest. It takes ages until the new virtualenv is setup with all 11 packages installed.
Running it with -vvv does not bring any new findings.
Yes, i'm running into the same problem. Resolving dependencies takes forever. I tried to use VPN to get through the GFW, nevertheless, it is still not working. I also tried to change pip source and wrote local source in the toml file, neither works. It's driving me nuts.
Reacted by Razvan Tudorica, Edward Bruner, Pavel Kalashnikov, doantientai, Antony Nyagah, SwordHeart, Yonatan Bitton, Crosstyan, Chris Lemke, Nicoli and 45 more
Reacted by rlin, Gary Lai, Sajjad hossan, Lucas Saldyt, Lwin Maung Maung, Iydon Liang, jonybar9, JCGoran, Maikel Ruiz, Yiyang Gu and 3 more
Reacted by Dominik Kozaczko, Kaustubh M, lv10, Dani Hodovic, Yagiz Degirmenci, Daan Klijn, Kyle King, Adrien Becchis, Lukasz Mentel, Bruce and 81 more
Reacted by zailai
Reacted by New, Juss Patel, Vitor Hugo, Pierre Mevel, Eric Jurio, Vladislav Varadinov, Brannon Dorsey, Maikel Ruiz, CofinCup, Muhammet Safa GÜNER and 1 more
changed the title [-]Poetry is extremely slow when resoling the dependencies[/-][+]Poetry is extremely slow when resolving the dependencies[/+]on Mar 12, 2020
Reacted by wayne lee, Nahuel Ambrosini, jacques-, Dani Hodovic, Rafal Skolasinski, elenahongo, Kyle King, Umair Ghuman, Daniel Kats, Andreas Donig and 24 more
Reacted by cdrcqnts, Loki Wijnen, Chrisjan Wüst, Eliaz Bobadilla, Antonio Martinez, Roma Hlushko and Leon Truong
Reacted by Dani Hodovic, Kyle King, earonesty, Baltazar Gomez, Eduardo Neto, Yousef Issa, Pavel Kalashnikov, Jan Jurec, Guangyu Gao, danieldaniu and 23 more
Reacted by Mehmet Dogan, Lucas Saldyt, Leo Silva and Maikel Ruiz
Reacted by Simon Perdrisat, Leandro Repolho, Dani Hodovic, Mathieu Rey, Rafal Skolasinski, Bruce, Dan Stephenson, Olivier Bondu, cdrcqnts, Loki Wijnen and 5 more
If you report that Poetry is slow, we would appreciate a pyproject.toml that reproduces the issue so we can debug what's going on and if it's on Poetry's end or just the expected behavior.
@gagarine Could you provide the pyproject.toml file you are using?
Reacted by Simon Perdrisat, Justin Sheehy, Julien Lhermitte, Dominik Kozaczko, Johannes Jasper, fairlix, Baltazar Gomez, Ramazan Polat, Olivier Bondu, Peter Schutt and 31 more
this fixed my issue: poetry cache clear --all pypi
I've seen this mentioned a few times, if it works that's great, but why would it work? Wouldn't clearing the cache cause things to take longer? What am I missing?
Clearing the cache is most likely related to clearing out partial/incomplete/corrupted by concurrent usage downloads that can cause an indefinite hang.
Reacted by Josh, Joel Gerber, Mohan and Robert J. Berger
This issue has gotten quite long and meandering, with many disparate causes, solutions, fixed issues, perhaps still extant bugs, and many "me too" comments all discussed.
I'm going to close this issue as most of the root causes discussed within have either been solved in 1.2 or 1.3 (the changes in 1.3 are behavior changes not eligible for backport).
If you are having issues with Poetry taking a long time to resolve dependencies, please first open a Discussion or start on Discord, as many of them are related to configuration and large search space (basically, you're creating exponential work for the solver and should tighten your constraints). Tooling to advise the user should be possible (if difficult to develop) in the long run, and anyone interested in tackling this hairy problem should reach out to the team via a Discussion or on Discord.
Past that, please make sure to test with the latest code (both on the 1.2 branch and master branch presently) when trying to reproduce resolver issues as we are making improvements all the time, and your issue may be fixed and pending release already.
Finally, good reproductions are needed for this category of issue. Many times they are related to transient network issues, pathologically bad cases due to decisions made around (low traffic, private) custom package indexes, or a corrupted cache/bad local config. Reproducing in a container with publicly available packages will mean that someone can dissect your issue and possibly fix it. If you can't reproduce it with public packages, but you can with private packages, there are still options -- everything from sharing details with the team in private, to creating 'imitation' repositories to reproduce an issue.
Please refrain from commenting on this issue more if it's not a mitigation/common solution -- "me too" is not very helpful and will send dozens of emails, and if you can reproduce bad performance consistently/in a clean environment it should be an issue. If you're stuck and need help, ask for support using one of the methods mentioned above.
Reacted by Daniel van Strien, Colt Jay and Julien Lerouge
@Kache, It appears to search through dependencies depth-first, rather than breadth-first. As a result, you've probably got a something earlier in your pyproject.toml that depends on ddtrace, so the dependency resolver grabbed that version and tried to resolve using that, rather than the ddtrace version you've specified.
I've had some success moving the dependencies I want exact version logic prioritizing earlier in the pyproject.toml file.
(I also disabled IPv6, upgraded to poetry 1.2x, and have reduced the possible space for the troubling aws libraries (boto3 and awscli, for me) so those go at the very end of my dependency file and have only a few recent versions to chew through.
I'm seeing dependency resolution time between 5 and 35 seconds most of the time now.
I have a private repository from gitlab which is know to have some problems with ipv6, I disabled ipv6 too and add this to my .ssh/config
Reducing the search space is not a workaround, but a common issue (as mentioned in my comment above). That being said, the version you have written should be equivalent (^3.10.0 and ^3.10) -- any differences you noticed with that change are likely unrelated.
That should expand to python_full_version >= "3.10.0" and python_version < "4.0" -- ^ is not defined to operate differently based on precision as far as I am aware. However, we are generating a lot of traffic on a tangential topic -- let's take it to a Discussion or Discord if you think my explanation is insufficient or incorrect.
Activity
David-OConnor commentedon Mar 4, 2020
Could this be due to downloading packages from pypi to inspect their dependencies, when not properly specified?
qiuwei commentedon Mar 6, 2020
It seems so. I have checked the detailed log, poetry kept retrying to resolve the dependency for botocore, but without success. So I assume that the dependency can be eventually resolved if enough time is given.
However, is there any way to get around this?
BTW, I also consider it's better to give some warning if there are some dependencies are not properly specified and could not be resolved after a number of attempts.
thmsklngr commentedon Mar 6, 2020
Hi,
I encounter a similiar problem on my MacOS. Python version used is 3.7.6, Poetry is 1.0.5. I just created a new project with no dependencies so far in pyproject.toml, just initially pytest. It takes ages until the new virtualenv is setup with all 11 packages installed.
Running it with -vvv does not bring any new findings.
Regards, Thomas
yalunren commentedon Mar 8, 2020
Yes, i'm running into the same problem. Resolving dependencies takes forever. I tried to use VPN to get through the GFW, nevertheless, it is still not working. I also tried to change pip source and wrote local source in the toml file, neither works. It's driving me nuts.
long2ice commentedon Mar 9, 2020
same here...😱
[-]Poetry is extremely slow when resoling the dependencies[/-][+]Poetry is extremely slow when resolving the dependencies[/+]luanfrv0 commentedon Mar 29, 2020
Same here. I just created an empty project then ran
poetry installand it takes so much time to resolve dependencies.luanfrv0 commentedon Mar 30, 2020
I'm currently using this workaround:
It takes a lower time space to install the package locally since all deps are already installed.
Make sure to run
poetry shellbefore to access the created virtual environment and install on it instead of on user/global path.MartinThoma commentedon Apr 6, 2020
Poetry being slow to resolve dependencies seems to be a reoccuring issue:
aoreki commentedon Apr 16, 2020
Maybe there is a dependency conflict.
gagarine commentedon Apr 19, 2020
No conflict. Poetry is slow as hell.
sdispater commentedon Apr 19, 2020
First of all, I want to say there is ongoing work to improve the dependency resolution.
However, there is so much Poetry can do with the current state of the Python ecosystem. I invite you to read https://python-poetry.org/docs/faq/#why-is-the-dependency-resolution-process-slow to know a little more about why the dependency resolution can be slow.
If you report that Poetry is slow, we would appreciate a
pyproject.tomlthat reproduces the issue so we can debug what's going on and if it's on Poetry's end or just the expected behavior.@gagarine Could you provide the
pyproject.tomlfile you are using?gagarine commentedon Apr 19, 2020
Take about 2min to resolve dependencies after adding newspaper3k on a fresh project.
Connexion: 40ms ping and 10Mb/s down.
pyproject.toml
250 remaining items
tall-josh commentedon Sep 15, 2022
Re:
I've seen this mentioned a few times, if it works that's great, but why would it work? Wouldn't clearing the cache cause things to take longer? What am I missing?
johnthagen commentedon Sep 15, 2022
@tall-josh Because Poetry had (maybe still has?) a bug where corrupted cache entries make Poetry hang forever when trying to resolve dependencies.
For me this seemed to occur if I Ctrl+C'd Poetry while it was doing an install and it was downloading packages.
I observed this on 1.1.14, so perhaps it's fixed in 1.2+.
neersighted commentedon Sep 15, 2022
Clearing the cache is most likely related to clearing out partial/incomplete/corrupted by concurrent usage downloads that can cause an indefinite hang.
namekkozZ commentedon Sep 20, 2022
add this to .toml file is work for me
[[tool.poetry.source]] name = 'aliyun.mirrors' url = 'https://mirrors.aliyun.com/pypi/simple/' default = truezailaib commentedon Sep 21, 2022
legioz commentedon Sep 27, 2022
Still have same problem on version 1.2.1
neersighted commentedon Sep 27, 2022
Hi all,
This issue has gotten quite long and meandering, with many disparate causes, solutions, fixed issues, perhaps still extant bugs, and many "me too" comments all discussed.
I'm going to close this issue as most of the root causes discussed within have either been solved in 1.2 or 1.3 (the changes in 1.3 are behavior changes not eligible for backport).
If you are having issues with Poetry taking a long time to resolve dependencies, please first open a Discussion or start on Discord, as many of them are related to configuration and large search space (basically, you're creating exponential work for the solver and should tighten your constraints). Tooling to advise the user should be possible (if difficult to develop) in the long run, and anyone interested in tackling this hairy problem should reach out to the team via a Discussion or on Discord.
Past that, please make sure to test with the latest code (both on the 1.2 branch and master branch presently) when trying to reproduce resolver issues as we are making improvements all the time, and your issue may be fixed and pending release already.
Finally, good reproductions are needed for this category of issue. Many times they are related to transient network issues, pathologically bad cases due to decisions made around (low traffic, private) custom package indexes, or a corrupted cache/bad local config. Reproducing in a container with publicly available packages will mean that someone can dissect your issue and possibly fix it. If you can't reproduce it with public packages, but you can with private packages, there are still options -- everything from sharing details with the team in private, to creating 'imitation' repositories to reproduce an issue.
Please refrain from commenting on this issue more if it's not a mitigation/common solution -- "me too" is not very helpful and will send dozens of emails, and if you can reproduce bad performance consistently/in a clean environment it should be an issue. If you're stuck and need help, ask for support using one of the methods mentioned above.
legioz commentedon Sep 27, 2022
I have a private repository from gitlab which is know to have some problems with ipv6, I disabled ipv6 too and add this to my
.ssh/configHost gitlab.com AddressFamily inetthen
sudo service ssh restartGot a huge improvement in dependencies resolver
ADR-007 commentedon Oct 10, 2022
I found one workaround:
You can specify requirements more precisely. E.g.: not
python="^3.10"butpython="^3.10.0"neersighted commentedon Oct 10, 2022
Reducing the search space is not a workaround, but a common issue (as mentioned in my comment above). That being said, the version you have written should be equivalent (
^3.10.0and^3.10) -- any differences you noticed with that change are likely unrelated.ADR-007 commentedon Oct 10, 2022
Actually, they a not equivalent:
^3.10means>=3.10,<4but^3.10.0means>=3.10,<3.11It reduces time from >2000s (I didn't wait more) to 200s
neersighted commentedon Oct 10, 2022
That should expand to
python_full_version >= "3.10.0" and python_version < "4.0"--^is not defined to operate differently based on precision as far as I am aware. However, we are generating a lot of traffic on a tangential topic -- let's take it to a Discussion or Discord if you think my explanation is insufficient or incorrect.petroslamb commentedon Nov 21, 2022