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.google-artifactregistry-auth failing with keyring 23.9.0 due to missing keyring.util.properties #593

Closed
sanderland opened this issue Sep 1, 2022 · 5 comments

Comments

@sanderland
Copy link

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
Copy link

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
Copy link

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

@yarikoptic
Copy link

here is how to looks to us
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 "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/appveyor/dlvenv/lib/python3.8/site-packages/keyrings/alt/file.py", line 9, in <module>
    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 "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/appveyor/dlvenv/lib/python3.8/site-packages/keyrings/alt/multi.py", line 3, in <module>
    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 "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/appveyor/dlvenv/lib/python3.8/site-packages/keyrings/alt/pyfs.py", line 7, in <module>
    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 <module>
    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
Copy link

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

@yarikoptic
Copy link

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.

yarikoptic added a commit to yarikoptic/keyring that referenced this issue Sep 2, 2022
…n warning if used

Unfortunately it is not a complete solution to jaraco#593 since there was likely
also a breakage in API of those properties since it would lead to e.g.

	(git)lena:~/proj/misc/keyrings.alt[main]git
	$> python -c 'import keyrings.alt.file'
	Traceback (most recent call last):
	  File "<string>", line 1, in <module>
	  File "/home/yoh/proj/misc/keyrings.alt/keyrings/alt/file.py", line 67, in <module>
		class EncryptedKeyring(Encrypted, Keyring):
	  File "/home/yoh/proj/misc/keyrings.alt/keyrings/alt/file.py", line 73, in EncryptedKeyring
		@properties.ClassProperty
	  File "/home/yoh/proj/misc/keyring/keyring/util/__init__.py", line 12, in __getattr__
		return getattr(_properties, a)
	AttributeError: module 'keyring._properties_compat' has no attribute 'ClassProperty'. Did you mean: 'classproperty'?
@jaraco jaraco closed this as completed in 83b6dd6 Sep 4, 2022
christian-monch pushed a commit to christian-monch/datalad that referenced this issue Sep 16, 2022
mcepl added a commit to openSUSE-Python/python-keyring-keyutils that referenced this issue Jul 24, 2023
Use jaraco.classes.properties instead (and yes, of course, the
upstream cannot keep API stable).

Fixes marcus-h#2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants