jaraco / keyring

MIT License
1.26k stars 159 forks source link

keyrings.google-artifactregistry-auth failing with keyring 23.9.0 due to missing keyring.util.properties #593

Closed sanderland closed 2 years ago

sanderland commented 2 years ago

Describe the bug

Our pipeline started failing around now. The key issue seemed to have been an unnecessary installation of the latest keyring somewhere in the pipeline.

For keyring-23.9.0, our pipeline failed with

  File "/usr/local/lib/python3.8/site-packages/keyrings/gauth.py", line 24, in <module>
    from keyring.util import properties
ImportError: cannot import name 'properties' from 'keyring.util' (/usr/local/lib/python3.8/site-packages/keyring/util/__init__.py)

And indeed it seems this file was removed.

Keeping at the older 23.8.2 version works, but it is surprising that a minor version bump would cause it to break.

CodyCBakerPhD commented 2 years ago

Also ran into this in the following GitHub Action: https://github.com/catalystneuro/neuroconv/runs/8136194375?check_suite_focus=true

Can confirm pinning requirement to keyring<=23.8.2 works as a temporary fix.

joel-cook-inmar commented 2 years ago

We also ran into this issue with pipelines in GCP Cloud Build. ImportError: cannot import name 'properties' from 'keyring.util'

yarikoptic commented 2 years ago
here is how to looks to us ```shell rror initializing plugin EntryPoint(name='file', value='keyrings.alt.file', group='keyring.backends'). Traceback (most recent call last): File "/home/appveyor/dlvenv/lib/python3.8/site-packages/keyring/backend.py", line 202, in _load_plugins init_func = ep.load() File "/home/appveyor/dlvenv/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 194, in load module = import_module(match.group('module')) File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 848, in exec_module File "", line 219, in _call_with_frames_removed File "/home/appveyor/dlvenv/lib/python3.8/site-packages/keyrings/alt/file.py", line 9, in from keyring.util import properties ImportError: cannot import name 'properties' from 'keyring.util' (/home/appveyor/dlvenv/lib/python3.8/site-packages/keyring/util/__init__.py) Error initializing plugin EntryPoint(name='multi', value='keyrings.alt.multi', group='keyring.backends'). Traceback (most recent call last): File "/home/appveyor/dlvenv/lib/python3.8/site-packages/keyring/backend.py", line 202, in _load_plugins init_func = ep.load() File "/home/appveyor/dlvenv/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 194, in load module = import_module(match.group('module')) File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 848, in exec_module File "", line 219, in _call_with_frames_removed File "/home/appveyor/dlvenv/lib/python3.8/site-packages/keyrings/alt/multi.py", line 3, in from keyring.util import properties ImportError: cannot import name 'properties' from 'keyring.util' (/home/appveyor/dlvenv/lib/python3.8/site-packages/keyring/util/__init__.py) Error initializing plugin EntryPoint(name='pyfs', value='keyrings.alt.pyfs', group='keyring.backends'). Traceback (most recent call last): File "/home/appveyor/dlvenv/lib/python3.8/site-packages/keyring/backend.py", line 202, in _load_plugins init_func = ep.load() File "/home/appveyor/dlvenv/lib/python3.8/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 194, in load module = import_module(match.group('module')) File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 848, in exec_module File "", line 219, in _call_with_frames_removed File "/home/appveyor/dlvenv/lib/python3.8/site-packages/keyrings/alt/pyfs.py", line 7, in from keyring.util import platform_, properties ImportError: cannot import name 'properties' from 'keyring.util' (/home/appveyor/dlvenv/lib/python3.8/site-packages/keyring/util/__init__.py) Traceback (most recent call last): File "/home/appveyor/dlvenv/bin/git-credential-datalad", line 8, in sys.exit(git_credential_datalad()) File "/home/appveyor/projects/datalad/datalad/local/gitcredential_datalad.py", line 89, in git_credential_datalad _action_store(attrs, interactive, providers) File "/home/appveyor/projects/datalad/datalad/local/gitcredential_datalad.py", line 161, in _action_store saved_provider.credential.set(user=attrs['username'], File "/home/appveyor/projects/datalad/datalad/downloaders/credentials.py", line 211, in set self._keyring.set(self.name, f, v) File "/home/appveyor/projects/datalad/datalad/support/keyring_.py", line 81, in set return self._keyring.set_password(self._get_service_name(name), field, value) File "/home/appveyor/dlvenv/lib/python3.8/site-packages/keyring/core.py", line 60, in set_password get_keyring().set_password(service_name, username, password) File "/home/appveyor/dlvenv/lib/python3.8/site-packages/keyring/backends/fail.py", line 25, in get_password raise NoKeyringError(msg) keyring.errors.NoKeyringError: No recommended backend was available. Install a recommended 3rd party backend package; or, install the keyrings.alt package if you want to use the non-recommended backends. See https://pypi.org/project/keyring for details. [gw0] FAILED ../datalad/local/tests/test_gitcredential.py::test_datalad_credential_helper ../datalad/local/tests/test_no_annex.py::test_no_annex ```
megan-kuo commented 2 years ago

this should be fixed with the newest release of keyrings.google-artifactregistry-auth. Please let me know if the issue persists, thanks!

yarikoptic commented 2 years ago

I just want to note that this issue is not specific to keyrings.google-artifactregistry-auth. As I reported above for me it happens due to that import being used also across many keyrings.alt:

(git)lena:~/proj/misc/keyrings.alt[main]git
$> git pull --ff-only
Already up to date.

$> git describe      
v4.1.1-6-g010fe59

$> git grep 'from keyring.util import properties'
keyrings/alt/Gnome.py:from keyring.util import properties
keyrings/alt/Google.py:from keyring.util import properties
keyrings/alt/Windows.py:from keyring.util import properties
keyrings/alt/file.py:from keyring.util import properties
keyrings/alt/multi.py:from keyring.util import properties

that is why IMHO should be fixed in keyring itself, and have proper deprecation cycle if desired to change interface and not have properties available from keyring.util. I also recommended establishing downstream testing (#594) to prevent such breakages in the future.