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 install is stuck on specific dependency with "pending..." #3352
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: 10.15.7
Poetry version: 1.1.4, 1.1.3, 1.0.9
Issue
Hello poetry crew. Loving the work that yall do!
I am having issues with poetry while running poetry install in one of my projects on one specific machine.
It appears to get stuck on one dependency during the install and it will hang forever. When I kill the process, I see this in my shell (hinting at a race condtion/locking problem):
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/Users/{}/.pyenv/versions/3.6.8/lib/python3.6/concurrent/futures/thread.py", line 40, in _python_exit
t.join()
File "/Users/{}/.pyenv/versions/3.6.8/lib/python3.6/threading.py", line 1056, in join
self._wait_for_tstate_lock()
File "/Users/{}/.pyenv/versions/3.6.8/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt
I am on the latest poetry (1.1.4) and have tried 1.1.3 as well with the same results (all of which while running python 3.6.8 (I did use 3.6.5 as well)).
After downgrade to 1.0.9, I no longer faced this issue. I am assuming that there was an update to the way poetry can download multiple deps at the same time. Anyone else facing locking issues? At the very least, poetry should recognize a pending download with no progress being made to exit and fail early, but it simply hung and would never exit (left it going for at least 30 mins).
Unfortunately, I cannot share the pyproject.toml as it contains a lot of proprietary names.
Is that on macos?
As noted above, mac OS 10.15.7 (catalina)
Were you able to identify if it hangs always on the same dependency or not?
It does indeed hang on the same dependency every time.
One other interesting thing to note:
I can manually go to the venv created by poetry and go to the pip that lives in its bin directory. When I pip install the problematic dependency (that hangs in the poetry install execution), it does install correctly. So it appears to focus the problem even further on the locking mechanism being used.
Same issue here. I just upgrade from v1.0.0, but got pending on some packages during installing , typically numpy , sklearn... The error message shows it got a read time out from my nexus repo, but it never happened before. And after I try the poetry install several times, it installed all package successfully. Does the parallel installation trigger this issue?
My advice would be to try one of those (maybe in that order) if you have not yet:
delete the poetry.lock file and retry
delete the virtual environment and retry
deactivate the new (parallel) installer with poetry config experimental.new-installer false and retry (do not forget to reactivate it afterwards if it proves to have no influence)
or any combination of those
Also maybe provide some verbose output (-vvv), that might be helpful for when one of the maintainers gets the time to handle this ticket. Of course, the best as always is if you can provide a minimal reproducible example that triggers the failure.
Reacted by Arne Groskurth, Linoy Belchich, Vaidik Kapoor, Asia, Ján Čabala, Sri Ramanujam, John Giorgi, ShedPlant, Pedro Grilo, Selim and 15 more
Reacted by Mobasshir Bhuiya Shagor, Ouafa Hachem, Sveltware Solutions and Olivier 'reivilibre'
I do experience the same problem with poetry 1.1.4 within a python 3.9 docker container. The error goes away by following the suggestion of @sinoroc to deactivate the experimental installer.
Reacted by Chris Adams, Pattharapong Chotechuang, Vaidik Kapoor, John Lucas, Merelda, Lucas Caetano Lopes Rodrigues, Sean Kelley, Valentin Pinkau and veriff-javiervgd
Same problem here, and disabling the experimental installer fixed it for me, too. My environment is this docker image: mcr.microsoft.com/vscode/devcontainers/python:0-3.8 with the following commands:
Could someone on the Poetry team provide a perspective on prioritization for this? It seems like there's meaningful evidence that this is an issue independent of environment or dependencies. Turning off the installer is a good workaround in the interim, but it significantly increases install times. I'd love to know I have some hope of being able to turn it back on at some point.
Disabling experimental installer also fixes this for me, but also able to fix it using the experimental installer by adding a timeout for the requests to pypi, E.g.
diff --git a/poetry/repositories/pypi_repository.py b/poetry/repositories/pypi_repository.py
index 1c7b7be3..a1f0922a 100644
--- a/poetry/repositories/pypi_repository.py+++ b/poetry/repositories/pypi_repository.py@@ -321,14 +321,14 @@ class PyPiRepository(RemoteRepository):
return data.asdict()
- def _get(self, endpoint: str) -> Union[dict, None]:+ def _get(self, endpoint: str, timeout: int = 5) -> Union[dict, None]:
try:
- json_response = self.session.get(self._base_url + endpoint)+ json_response = self.session.get(self._base_url + endpoint, timeout=timeout)
except requests.exceptions.TooManyRedirects:
# Cache control redirect loop.
# We try to remove the cache and try again
self._cache_control_cache.delete(self._base_url + endpoint)
- json_response = self.session.get(self._base_url + endpoint)+ json_response = self.session.get(self._base_url + endpoint, timeout=timeout)
if json_response.status_code == 404:
return None
Reacted by Ty Schlichenmeyer, Dimitar Ganev, Annie, hgpark, José Sánchez-Gallego, Oozie Ligus, Evandro Pomatti, Tamir Aviv, Espen Halvorsen, Andy Yee and 1 more
FWIW I deleted my poetry cache and artifacts (~/.cache/pypoetry/cache/), and found "things" to work again. If there is any wisdom as to when/why corruption in these locations leads to such an inability to install venvs, that would be educational.
$ poetry cache list
$ poetry cache clear --all pypi
didn't work
only yours worked:
cd ~/.cache/pypoetry/cache/
rm -rf artifacts/ cache/
Reacted by Lucas Caetano Lopes Rodrigues, Robert J. Berger, Iulia Sincai, JELTI IMANE, Fangrou JI, Victor Augusto, Mohammad Javad Naderi, Pavel Vergeev, dan-hook and younghwan-kim-ringle
Reacted by Iulia Sincai, Mickx971, Talal and dan-hook
Both of these will not be backported to 1.2 as they are new changes to Poetry behavior/not fixes for regressions, but they will be available in the near future, and you can test them today by installing from master. Clearing the cache is a standard troubleshooting step, and always worth doing (indeed --no-cache is a handy global flag that lets you ignore the cache without actually clearing it).
Artifacts are distfiles (wheels, sdists) and can be corrupted by an interrupted Poetry (ctrl-c, machine shutdown) as well as a concurrent Poetry. This will be fixed in the 1.3 release.
Reacted by Zach Liu, Paweł Rubin and Lukas Weidenholzer
I had problems with this due to "Connection pool is full, discarding connection: pypi.org. Connection pool size: 10". It helped to set poetry config installer.max-workers 10. Should we consider that as an upper bound to the default? I think I might have something like 8 cores, which takes the worker number to 12.
The artifacts and cache dirs were in ~/Library/Caches/pypoetry on my M1 Mac for those who can't find it in ~/.cache/pypoetry/cache/
cd ~/Library/Caches/pypoetry
rm -rf artifacts/ cache/
Doing that cleared things up for me. Before that, it was consistently hanging on trying to fetch flake8-bugbear from pypy
Reacted by Thomas Werkmeister, Will Karnasiewicz, Caio Lopes, Harley Alexander, Necatican Yıldırım, briant-spindance, igormusinov01, Daniel van der Ende, Francisco Reis, Onno Eberhard and 7 more
Reacted by Harley Alexander and Frank Hoffsümmer
Reacted by Harley Alexander, Frank Hoffsümmer and Eugene
Reacted by Harley Alexander, TJ Bollerman, Frank Hoffsümmer, Miles Mason Winther and Pooja Kulkarni
You can always find the cache directory with poetry config cache-dir. If you're having issues you think might be related, try clearing the cache first. If you're still having issues, I'd suggest opening a Discussion or joining Discord first as 90% of the time these are local config issues.
I would ask that if you don't have anything to add that hasn't already been said in this issue, you hold off, as generating notifications for 20+ people for a root cause that is solved is unnecessary (and if you have something novel, we want to identify that and make sure it's tracked as a new issue).
My advice would be to try one of those (maybe in that order) if you have not yet:
* delete the `poetry.lock` file and retry
* delete the virtual environment and retry
* deactivate the new (parallel) installer with `poetry config experimental.new-installer false` and retry (do not forget to reactivate it afterwards if it proves to have no influence)
* or any combination of those
Also maybe provide some verbose output (-vvv), that might be helpful for when one of the maintainers gets the time to handle this ticket. Of course, the best as always is if you can provide a minimal reproducible example that triggers the failure.
In my case deactivating the new (parallel) installer solved the problem. It was stuck on installing pycparser 2.21 and six 1.16.0 (maybe it will be useful)
If deactivating the new installer helps, you have a corrupted artifact cache. Please rm -rf $(poetry config cache-dir)/artifacts and try again. I am locking this issue as it keeps misleading people -- most of the issues here are solved, including the artifact corruption issue. Disabling the new installer is not sustainable (as the old installer is scheduled for removal), so please follow the troubleshooting steps outlined.
If, after doing the following, you still reproduce on the latest version of Poetry, please open a new issue so we can fix bugs in the new installer:
Activity
sinoroc commentedon Nov 11, 2020
Maybe it would be helpful to see the
pyproject.toml. Is that on macos? Were you able to identify if it hangs always on the same dependency or not?cpvandehey commentedon Nov 11, 2020
Unfortunately, I cannot share the pyproject.toml as it contains a lot of proprietary names.
As noted above, mac OS 10.15.7 (catalina)
It does indeed hang on the same dependency every time.
One other interesting thing to note:
I can manually go to the venv created by poetry and go to the pip that lives in its bin directory. When I pip install the problematic dependency (that hangs in the poetry install execution), it does install correctly. So it appears to focus the problem even further on the locking mechanism being used.
DeepDarkOdyssey commentedon Nov 24, 2020
Same issue here. I just upgrade from v1.0.0, but got pending on some packages during installing , typically numpy , sklearn... The error message shows it got a read time out from my nexus repo, but it never happened before. And after I try the poetry install several times, it installed all package successfully. Does the parallel installation trigger this issue?
sinoroc commentedon Nov 24, 2020
I do not know how to help you all here...
My advice would be to try one of those (maybe in that order) if you have not yet:
poetry.lockfile and retrypoetry config experimental.new-installer falseand retry (do not forget to reactivate it afterwards if it proves to have no influence)Also maybe provide some verbose output (
-vvv), that might be helpful for when one of the maintainers gets the time to handle this ticket. Of course, the best as always is if you can provide a minimal reproducible example that triggers the failure.arnegroskurth commentedon Dec 21, 2020
I do experience the same problem with poetry 1.1.4 within a python 3.9 docker container. The error goes away by following the suggestion of @sinoroc to deactivate the experimental installer.
pyproject.toml:
poetry.lock.txt
vaidik commentedon May 17, 2021
I can confirm that disabling the experimental parallel installer worked. My environment, although, was Docker, particularly the python:3.8-slim image.
ohthehugemanatee commentedon Jun 2, 2021
Same problem here, and disabling the experimental installer fixed it for me, too. My environment is this docker image:
mcr.microsoft.com/vscode/devcontainers/python:0-3.8with the following commands:jlucas91 commentedon Aug 5, 2021
Could someone on the Poetry team provide a perspective on prioritization for this? It seems like there's meaningful evidence that this is an issue independent of environment or dependencies. Turning off the installer is a good workaround in the interim, but it significantly increases install times. I'd love to know I have some hope of being able to turn it back on at some point.
dbowring commentedon Sep 9, 2021
Disabling experimental installer also fixes this for me, but also able to fix it using the experimental installer by adding a timeout for the requests to pypi, E.g.
GerevSec commentedon Mar 12, 2022
Happens on WSL2 ubuntu 20.04 with python3.10
schlich commentedon Mar 17, 2022
Recent issues possibly related to discussion happening in #2094
epomatti commentedon Jun 19, 2022
On Ubuntu 20.04 WSL2 here. Only disabling IPv6 did the trick:
dimbleby commentedon Jun 19, 2022
#3352 (comment) suggests a very plausible fix, perhaps someone would like to submit an MR.
10 remaining items
Purg commentedon Sep 21, 2022
FWIW I deleted my poetry cache and artifacts (
~/.cache/pypoetry/cache/), and found "things" to work again. If there is any wisdom as to when/why corruption in these locations leads to such an inability to install venvs, that would be educational.zachliu commentedon Sep 22, 2022
@Purg thank you sire! i've been stuck on this for hours... i tried all these:
turn off the
experimental.new-installerbut this only worked "for a moment" then stopped working:
delete virtualenv - didn't work
delete
poetry.lock- didn't workclear all cache by running (see Poetry is extremely slow when resolving the dependencies #2094 (comment))
didn't work
only yours worked:
neersighted commentedon Sep 22, 2022
The reason for corrupted caches is either:
Both of these will not be backported to 1.2 as they are new changes to Poetry behavior/not fixes for regressions, but they will be available in the near future, and you can test them today by installing from
master. Clearing the cache is a standard troubleshooting step, and always worth doing (indeed--no-cacheis a handy global flag that lets you ignore the cache without actually clearing it).zachliu commentedon Sep 22, 2022
my last question: what's the difference between
and
?
neersighted commentedon Sep 22, 2022
poetry cache clearis like deleting the cache folder, but does not affect the artifacts folder.zachliu commentedon Sep 22, 2022
artifacts are just
whlpackages, maybe they are corrupted too? 🤔i'll remember to clear both artifacts and cache in the future
neersighted commentedon Sep 22, 2022
Artifacts are distfiles (wheels, sdists) and can be corrupted by an interrupted Poetry (ctrl-c, machine shutdown) as well as a concurrent Poetry. This will be fixed in the 1.3 release.
TallGirlVanessa commentedon Oct 4, 2022
I had problems with this due to "Connection pool is full, discarding connection: pypi.org. Connection pool size: 10". It helped to set
poetry config installer.max-workers 10. Should we consider that as an upper bound to the default? I think I might have something like 8 cores, which takes the worker number to 12.rberger commentedon Oct 5, 2022
The artifacts and cache dirs were in
~/Library/Caches/pypoetryon my M1 Mac for those who can't find it in~/.cache/pypoetry/cache/Doing that cleared things up for me. Before that, it was consistently hanging on trying to fetch
flake8-bugbearfrom pypyneersighted commentedon Oct 5, 2022
You can always find the cache directory with
poetry config cache-dir. If you're having issues you think might be related, try clearing the cache first. If you're still having issues, I'd suggest opening a Discussion or joining Discord first as 90% of the time these are local config issues.I would ask that if you don't have anything to add that hasn't already been said in this issue, you hold off, as generating notifications for 20+ people for a root cause that is solved is unnecessary (and if you have something novel, we want to identify that and make sure it's tracked as a new issue).
bhuiyanmobasshir94 commentedon Nov 21, 2022
This solution helped me. Thank you.
Lamarcke commentedon Dec 31, 2022
I'm facing this issue in the latest Poetry version.
This helps:
PitterRup commentedon Jan 3, 2023
In my case deactivating the new (parallel) installer solved the problem. It was stuck on installing
pycparser 2.21andsix 1.16.0(maybe it will be useful)neersighted commentedon Jan 3, 2023
If deactivating the new installer helps, you have a corrupted artifact cache. Please
rm -rf $(poetry config cache-dir)/artifactsand try again. I am locking this issue as it keeps misleading people -- most of the issues here are solved, including the artifact corruption issue. Disabling the new installer is not sustainable (as the old installer is scheduled for removal), so please follow the troubleshooting steps outlined.If, after doing the following, you still reproduce on the latest version of Poetry, please open a new issue so we can fix bugs in the new installer:
poetry env remove --allpoetry cache clear --all .rm -rf $(poetry config cache-dir)/artifacts