Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keyrings.alt.Windows used unter linux if python 3 used #1968

Closed
3 tasks done
jedie opened this issue Feb 1, 2020 · 5 comments
Closed
3 tasks done

keyrings.alt.Windows used unter linux if python 3 used #1968

jedie opened this issue Feb 1, 2020 · 5 comments
Labels
kind/bug Something isn't working as expected

Comments

@jedie
Copy link

jedie commented Feb 1, 2020

  • I am on the latest Poetry version.
  • 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).
  • Ubuntu 18.04
  • Poetry v1.0.3

Issue

I like to start poerty directly with Python v3, so i change the shebang in ~/.poetry/bin/poetry to:

#!/usr/bin/env python3

But then i get a very strange traceback while poetry publish:

Error initializing plugin EntryPoint(name='Windows (alt)', value='keyrings.alt.Windows', group='keyring.backends').
Traceback (most recent call last):
  File "/home/jens/.poetry/lib/poetry/_vendor/py3.6/keyring/backend.py", line 203, in _load_plugins
    init_func = ep.load()
  File "/home/jens/.poetry/lib/poetry/_vendor/py3.6/importlib_metadata/__init__.py", line 95, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/Windows.py", line 9, in <module>
    from . import file_base
  File "/usr/lib/python3/dist-packages/keyrings/alt/file_base.py", line 13, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint(name='file', value='keyrings.alt.file', group='keyring.backends').
Traceback (most recent call last):
  File "/home/jens/.poetry/lib/poetry/_vendor/py3.6/keyring/backend.py", line 203, in _load_plugins
    init_func = ep.load()
  File "/home/jens/.poetry/lib/poetry/_vendor/py3.6/importlib_metadata/__init__.py", line 95, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/file.py", line 11, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
Error initializing plugin EntryPoint(name='pyfs', value='keyrings.alt.pyfs', group='keyring.backends').
Traceback (most recent call last):
  File "/home/jens/.poetry/lib/poetry/_vendor/py3.6/keyring/backend.py", line 203, in _load_plugins
    init_func = ep.load()
  File "/home/jens/.poetry/lib/poetry/_vendor/py3.6/importlib_metadata/__init__.py", line 95, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/keyrings/alt/pyfs.py", line 8, in <module>
    from keyring.util.escape import escape as escape_for_ini
ModuleNotFoundError: No module named 'keyring.util.escape'
@jedie jedie added the kind/bug Something isn't working as expected label Feb 1, 2020
@zeezdev
Copy link

zeezdev commented Mar 11, 2020

There is the similar problem in dbxfs: https://github.com/rianhunter/dbxfs/issues/14

This issue may be resolved with the upgrade of keyrings.alt: pip3 install --upgrade keyrings.alt

@jedie
Copy link
Author

jedie commented Mar 18, 2020

pip3 install --upgrade keyrings.alt

Yes, it helps to remove ModuleNotFoundError: No module named 'keyring.util.escape'
But it's only a work-a-round for a bug in poetry.

@dazza-codes
Copy link
Contributor

dazza-codes commented Feb 10, 2021

Similar error on linux where an OSX keyring plugin raises an error:

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"

$ python --version
Python 3.7.9

$ poetry --version
Poetry version 1.1.4

$ poetry publish --build --dry-run
There are 2 files ready for publishing. Build anyway? (yes/no) [no] yes
Building py-dev-deps (0.2.0)
  - Building sdist
  - Built py-dev-deps-0.2.0.tar.gz
  - Building wheel
  - Built py_dev_deps-0.2.0-py3-none-any.whl

Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.macOS', group='keyring.backends').
Traceback (most recent call last):
  File "/home/joe/.poetry/lib/poetry/_vendor/py3.7/keyring/backend.py", line 198, in _load_plugins
    init_func = ep.load()
  File "/home/joe/.poetry/lib/poetry/_vendor/py3.7/importlib_metadata/__init__.py", line 105, in load
    module = import_module(match.group('module'))
  File "/opt/conda/envs/py-dev-deps/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.macOS'

Looks like it could be useful to build some plugin abstractions for OS-specific init that handle any module-missing exceptions gracefully.

@abn
Copy link
Member

abn commented Mar 2, 2024

I like to start poerty directly with Python v3, so i change the shebang in ~/.poetry/bin/poetry to:

#!/usr/bin/env python3

This will not work since you basically are asking poetry to execute under an environment that it was not installed into. I'd suggest trying a new version of poetry installed using a method mentioned at https://python-poetry.org/docs/#installation.

This is also likely issues with keyring not functioning correctly under a non-interactive environment. There are improvements to that part of the code in upcoming releases. #8623 #9065

Meanwhile if keyring issues persist use temporarily.

export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring

If the issue is different to existing ones, please file a new issue with information on how best we could reliably reproduce it.

@abn abn closed this as not planned Won't fix, can't repro, duplicate, stale Mar 2, 2024
Copy link

github-actions bot commented Apr 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

4 participants