When trying to install a package with Poetry over SSH, you might run into this error:
$ poetry add Pygments Failed to unlock the collection!
This is caused when you don't have an initialised keyring/Secret Service [1] running, which gives applications a safe place to store credentials, etc.
This issue typically occurs when connecting over SSH as it may not even be spawning it.
Solution
The fix is to simply disable the keyring so that Poetry does not try to query it.
$ keyring --disable $ poetry add Pygments Using version ^2.13.0 for Pygments Updating dependencies Resolving dependencies... [..]