poetry: Regression: Poetry 1.7 hangs instead of asking to unlock keyring
-
Poetry version: 1.7.0
-
Python version: 3.11.6
-
OS version and name: Debian trixie (testing) running in a Chrome OS Linux container
-
pyproject.toml: https://gist.github.com/ilyagr/1bebabebc93e6662d139009d19ed8c1b/edit (includes poetry.lock and detailed command-line output as well).
-
I am on the latest stable Poetry version, installed using a recommended method.
-
I have searched the issues of this repo and believe that this is not a duplicate.
-
I have consulted the FAQ and blog for any relevant entries or release notes.
-
If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option) and have included the output below.
Issue
This is a follow-up to https://github.com/python-poetry/poetry/pull/1917 and https://github.com/python-poetry/poetry/pull/8227. I also mentioned this briefly in https://github.com/python-poetry/poetry/issues/1917#issuecomment-1793322478
The bug happens when I run either poetry install
or poetry lock
.
-
Poetry 1.6.1 behavior: a Gnome (gnome-keyring or seahorse, I’m unsure) window opens and asks to unlock a keyring. If I click cancel (refuse to unlock the keyring), poetry fails with an exception as described in #8227.
-
Current Poetry 1.7 behavior: no Gnome window opens, poetry just freezes for a while.
With Poetry 1.7, I also tried rebooting. After a reboot, a Gnome window does appear. After clicking cancel (refuse to unlock the keyring), it reappears. After clicking cancel ~10 more times, it stops reappearing and hangs again.
rm -r ~/.cache/pypoetry
as suggested in https://github.com/python-poetry/poetry/issues/1917#issuecomment-1770241003 did not help, with or without reinstalling poetry
(via pipx
, in my case)
Expected behavior
poetry does not try to unlock the keyring unless it is performing an operation that can’t succeed without access to the keyring (e.g., already failed without access to the keyring).
Alternatively, a somewhat inferior option would be to have some way to tell poetry not to try unlocking any keyrings that is easier to discover than the workaround below. Additionally, there would be a user-friendly message suggesting that option whenever unlocking the keyrings doesn’t work.
Workaround
The workaround of export PYTHON_KEYRING_BACKEND=keyring.backends.fail.Keyring
from https://github.com/python-poetry/poetry/issues/1917#issuecomment-1235998997 still works.
Command-line output
See https://gist.github.com/ilyagr/1bebabebc93e6662d139009d19ed8c1b for details.
The end of it is often the following printed to stderr
:
[keyring.backend] Loading SecretService
[keyring.backend] Loading Windows
[keyring.backend] Loading chainer
[keyring.backend] Loading libsecret
[keyring.backend] Loading macOS
At this point, it hangs forever.
About this issue
- Original URL
- State: open
- Created 8 months ago
- Reactions: 30
- Comments: 16 (1 by maintainers)
Commits related to this issue
- poetry: Poetry 1.7 issues 1. Add --no-root to poetry invocations. Poetry 1.7 displays an error otherwise (though things still work) https://github.com/orgs/python-poetry/discussions/8622 https://git... — committed to ilyagr/jj by ilyagr 8 months ago
- poetry: Poetry 1.7 issues 1. Add --no-root to poetry invocations. Poetry 1.7 displays an error otherwise (though things still work) https://github.com/orgs/python-poetry/discussions/8622 https://git... — committed to ilyagr/jj by ilyagr 8 months ago
- poetry: Poetry 1.7 issues 1. Add --no-root to poetry invocations. Poetry 1.7 displays an error otherwise (though things still work) https://github.com/orgs/python-poetry/discussions/8622 https://git... — committed to martinvonz/jj by ilyagr 8 months ago
Confirming I’m getting exactly the same behaviour on an Ubuntu dev container with no X server. Both the following workarounds worked for me, but aren’t ideal. I do have private repositories in my pyproject.toml, and have configured & tested working access via Github PAT stored in ~/.git-credentials.
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
pyenv shell system
followed bypython3 -m keyring --disable
I found this Poetry setting, which seems likely to be the official way of disabling the keyring, but I haven’t had a chance to try it yet.
have you try ? it works for me
Nice! Seems like it works. To clarify, you can change it with
poetry config keyring.enabled false
Same issue on Debian 12.
oh my, yes this is key, i was trying to troubleshoot a server based install and wondering if a keyring prompt was being expected to pop up where this was hanging (debian12). Thanks for the poetry config example to disable this @damtharvey and @n00bsys0p
Good to know. The default should be
False
, just my 2 cents.I have the exact same issue on Ubuntu 20.04.6 LTS and poetry version 1.7.1.
thank you for the workaround, it worked