6

I tried to upgrade my poetry from 1.1.x version to 1.3 but as an official manual (https://python-poetry.org/docs/) recommends I removed the old version manually. Unfortunately I probably deleted wrong files because after installing 1.3 version I was still receiving errors that seemed sth was in conflict with old poetry. I tried to find all files in my account (it's a remote machine so I did not want to effect others) connected somehow with poetry (with find /home/username -name *poetry*) and (after uninstalling poetry 1.3) removed them. Then I installed poetry 1.3 back but still did not work. Also tried to delete my whole repo and clone it again, but same problems remains. I guess I pissed it off already, but hope that there is some way to some hard reset. Is there any way how to get from this?

Here is beginning of my error message:


Package operations: 28 installs, 0 updates, 0 removals

  • Installing certifi (2021.10.8)
  • Installing charset-normalizer (2.0.12)
  • Installing idna (3.3)
  • Installing six (1.16.0)
  • Installing typing-extensions (4.2.0)
  • Installing urllib3 (1.26.9)

  DBusErrorResponse

  [org.freedesktop.DBus.Error.UnknownMethod] ('No such interface “org.freedesktop.DBus.Properties” on object at path /org/freedesktop/secrets/collection/login',)

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/util.py:48 in send_and_get_reply
       44│     def send_and_get_reply(self, msg: Message) -> Any:
       45│         try:
       46│             resp_msg: Message = self._connection.send_and_get_reply(msg)
       47│             if resp_msg.header.message_type == MessageType.error:
    →  48│                 raise DBusErrorResponse(resp_msg)
       49│             return resp_msg.body
       50│         except DBusErrorResponse as resp:
       51│             if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
       52│                 raise ItemNotFoundException('Item does not exist!') from resp

The following error occurred when trying to handle this error:


  ItemNotFoundException

  Item does not exist!

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/util.py:52 in send_and_get_reply
       48│                 raise DBusErrorResponse(resp_msg)
       49│             return resp_msg.body
       50│         except DBusErrorResponse as resp:
       51│             if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
    →  52│                 raise ItemNotFoundException('Item does not exist!') from resp
       53│             elif resp.name in (DBUS_SERVICE_UNKNOWN, DBUS_EXEC_FAILED,
       54│                                DBUS_NO_REPLY):
       55│                 data = resp.data
       56│                 if isinstance(data, tuple):

The following error occurred when trying to handle this error:


  PromptDismissedException

  Prompt dismissed.

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/collection.py:159 in create_collection
      155│     if len(collection_path) > 1:
      156│         return Collection(connection, collection_path, session=session)
      157│     dismissed, result = exec_prompt(connection, prompt)
      158│     if dismissed:
    → 159│         raise PromptDismissedException('Prompt dismissed.')
      160│     signature, collection_path = result
      161│     assert signature == 'o'
      162│     return Collection(connection, collection_path, session=session)
      163│ 

The following error occurred when trying to handle this error:


  InitError

  Failed to create the collection: Prompt dismissed..

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/keyring/backends/SecretService.py:63 in get_preferred_collection
       59│                 collection = secretstorage.Collection(bus, self.preferred_collection)
       60│             else:
       61│                 collection = secretstorage.get_default_collection(bus)
       62│         except exceptions.SecretStorageException as e:
    →  63│             raise InitError("Failed to create the collection: %s." % e)
       64│         if collection.is_locked():
       65│             collection.unlock()
       66│             if collection.is_locked():  # User dismissed the prompt
       67│                 raise KeyringLocked("Failed to unlock the collection!")


  DBusErrorResponse

  [org.freedesktop.DBus.Error.UnknownMethod] ('No such interface “org.freedesktop.DBus.Properties” on object at path /org/freedesktop/secrets/collection/login',)

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/util.py:48 in send_and_get_reply
       44│     def send_and_get_reply(self, msg: Message) -> Any:
       45│         try:
       46│             resp_msg: Message = self._connection.send_and_get_reply(msg)
       47│             if resp_msg.header.message_type == MessageType.error:
    →  48│                 raise DBusErrorResponse(resp_msg)
       49│             return resp_msg.body
       50│         except DBusErrorResponse as resp:
       51│             if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
       52│                 raise ItemNotFoundException('Item does not exist!') from resp

The following error occurred when trying to handle this error:


  ItemNotFoundException

  Item does not exist!

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/util.py:52 in send_and_get_reply
       48│                 raise DBusErrorResponse(resp_msg)
       49│             return resp_msg.body
       50│         except DBusErrorResponse as resp:
       51│             if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
    →  52│                 raise ItemNotFoundException('Item does not exist!') from resp
       53│             elif resp.name in (DBUS_SERVICE_UNKNOWN, DBUS_EXEC_FAILED,
       54│                                DBUS_NO_REPLY):
       55│                 data = resp.data
       56│                 if isinstance(data, tuple):

The following error occurred when trying to handle this error:


  PromptDismissedException

  Prompt dismissed.

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/collection.py:159 in create_collection
      155│     if len(collection_path) > 1:
      156│         return Collection(connection, collection_path, session=session)
      157│     dismissed, result = exec_prompt(connection, prompt)
      158│     if dismissed:
    → 159│         raise PromptDismissedException('Prompt dismissed.')
      160│     signature, collection_path = result
      161│     assert signature == 'o'
      162│     return Collection(connection, collection_path, session=session)
      163│ 

Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
Emil Haas
  • 484
  • 3
  • 17
  • [You might find some clues in this answer](https://stackoverflow.com/a/70064450/315168). – Mikko Ohtamaa Jan 11 '23 at 10:33
  • 1
    I tried all your advises, but neither helped unfortunately – Emil Haas Jan 11 '23 at 13:44
  • Do you know what is `secretstorage` and why your system tries to use it when running Poetry? – Mikko Ohtamaa Jan 11 '23 at 13:54
  • Because this is not a part of standard poetry process and first time I am seeing this. – Mikko Ohtamaa Jan 11 '23 at 14:04
  • I was not aware of `secretstorage` but it seems it is some helper package. But not sure for which package it is needed and it is not specified in my poetry.lock file (what is not problem when I tried on different PC that had not installed poetry 1.1 before) – Emil Haas Jan 11 '23 at 15:48
  • I edited my error message - I added beginning of it into the question. Actually I found guy having the same error [here](https://github.com/python-poetry/poetry/issues/6558) but he was just refered [here](https://github.com/python-poetry/poetry/issues/1917). There are some tips to set PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring, but I do not know where to do that and not able to ask there. I tried to add it to som config files but either that wasn't my case or I used wrong configs... – Emil Haas Jan 11 '23 at 16:40

1 Answers1

12

Finally I was able to find the answer here.

There are several ways to do that:

  1. Running export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring in shell will work for following poetry commands until you close (exit) your shell session

  2. Add environment variable for each! poetry command, for example PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry install

  3. If you want to preserve (store) this environment variable between shell sessions or system reboot you can add it in .bashrc and .profile example for bash shell:

    echo 'export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring' >> ~/.bashrc

    echo 'export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring' >> ~/.profile exec "$SHELL"

for case number 3) you can now run any poetry command as usual, even after system restart

Emil Haas
  • 484
  • 3
  • 17