Poetry stuck in infinite install/update
Asked Answered
C

4

20

My issue is that when I execute poetry install, poetry update or poetry lock the process keeps running indefinitely.

I tried using the -vvv flag to get output of what's happening and it looks like it gets stuck forever in the first install.

My connection is good and all packages that I tried installing exist.

I use version 1.2.1 but I cannot upgrade to newer versions because the format of the .lock file is different and our pipeline fails.

Citify answered 30/12, 2022 at 10:52 Comment(3)
poetry cache clear --all pypi and poetry cache clear --all _default_cache did it for me.Your
It cloud be related to the parallel installer. Try: poetry config experimental.new-installer falseGagarin
OS: Mac 13.3 Python: 3.8 I ran the below two commands and it worked: poetry cache clear pypi --all poetry cache clear _default_cache --allArica
C
18

I found a clue in an issue on the GitHub repo.

If you are using Linux you must delete all .lock files in the .cache/pypoetry dir in your user home directory.

find ~/.cache/pypoetry -name '*.lock' -type f -delete

If the directory does not exist maybe is in another location.

Then I recommend removing the generated .lock file in the project you were doing the installation.

Citify answered 30/12, 2022 at 10:52 Comment(1)
You can use poetry config cache-dir to find the locationToor
C
12

Another possibility is a corrupted artifact cache. (Source)

You can remove all the virtual environments, clear the cache, and delete the contents of the poetry artifacts directory using the following:

poetry env remove --all
poetry cache clear --all .
rm -rf $(poetry config cache-dir)/artifacts

Additionally, you could also delete the poetry.lock file and try poetry install again.

Chowchow answered 22/5, 2023 at 18:54 Comment(1)
less of a nuclear option: just poetry cache clear --all . worked for me.Corm
P
6

if you have boto3 (AWS) as dependency, you should specify the version of urllib3 to be smaller than 2, so for example (in pyproject.toml):

boto3 = "^1.24.43"
urllib3 = "<2"

This solves the infinite "poetry lock" in my case (nothing else worked).

Edit: this also worked for me in another project which did NOT have boto3 (so simply setting urllib3 <2 was enough)

Parallelize answered 21/2, 2024 at 10:48 Comment(3)
one of the discussions: github.com/orgs/python-poetry/discussions/…Bartram
This didn't work for me. Neither did anything on this stack. Sigh. I had high hopes for Poetry. I developed a new Quart site on my Mac, deployed it with Git to my Ubuntu server, and it locks on very first attempt at install. There is no other poetry environments on the server at all.Antiknock
I found a fix that works. poetry config keyring.enabled falseAntiknock
P
2

As @Daniel Byrne said in the comments:

poetry config keyring.enabled false

This seems to work best.

Phenylketonuria answered 3/7, 2024 at 5:40 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.