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

No module named 'keyring.backends.OS_X' after upgrade to 22 #486

Closed
gothicVI opened this issue Jan 25, 2021 · 12 comments
Closed

No module named 'keyring.backends.OS_X' after upgrade to 22 #486

gothicVI opened this issue Jan 25, 2021 · 12 comments

Comments

@gothicVI
Copy link

When updating keyring from version 21.8.0 to 22.0.0, using pip version 21.0 on Linux, I get:

ERROR: Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.OS_X', group='keyring.backends').
Traceback (most recent call last):
  File "/home/sebastian/.local/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 171, in _merge_into_criterion
    crit = self.state.criteria[name]
KeyError: 'keyring'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sebastian/.local/lib/python3.8/site-packages/keyring/backend.py", line 200, in _load_plugins
    init_func = ep.load()
  File "/usr/lib/python3.8/importlib/metadata.py", line 77, 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 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.OS_X'
$ pip list | grep keyring
keyring                           22.0.0
$ keyring --list-backends
Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.OS_X', group='keyring.backends').
Traceback (most recent call last):
  File "/home/sebastian/.local/lib/python3.8/site-packages/keyring/backend.py", line 200, in _load_plugins
    init_func = ep.load()
  File "/usr/lib/python3.8/importlib/metadata.py", line 77, 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 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.OS_X'
keyring.backends.kwallet.DBusKeyring (priority: 4.9)
keyring.backends.fail.Keyring (priority: 0)
keyring.backends.chainer.ChainerBackend (priority: 10)
keyring.backends.SecretService.Keyring (priority: 5)
@JD-Veiga
Copy link

Similar troubles while executing pip list -o with pip 21.0 and keyring 22.0.0 (running Python 3.8.7 on macOS 22.0.0).

I think that this error is caused by commit 4aed205.

My traceback for pip list -o is:

ERROR: Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.OS_X', group='keyring.backends').
Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/keyring/backend.py", line 200, in _load_plugins
    init_func = ep.load()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/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 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.OS_X'

repeated several times.

Thank you.

@gothicVI
Copy link
Author

@JD-Veiga I'm seeing similar errors now as well whenever I call pip list --outdated or update other packages.

@jaraco
Copy link
Owner

jaraco commented Jan 26, 2021

I'm unable to replicate the reported issue:

~ $ docker run -it jaraco/multipy-tox
root@f45a9db37817:/# pip install -U pip
Requirement already satisfied: pip in /usr/local/lib/python3.9/dist-packages (20.3.3)
Collecting pip
  Downloading pip-21.0-py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 731 kB/s 
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.3.3
    Uninstalling pip-20.3.3:
      Successfully uninstalled pip-20.3.3
Successfully installed pip-21.0
root@f45a9db37817:/# pip install keyring==21.8.0
Collecting keyring==21.8.0
  Downloading keyring-21.8.0-py3-none-any.whl (32 kB)
Collecting SecretStorage>=3.2
  Downloading SecretStorage-3.3.0-py3-none-any.whl (14 kB)
Collecting jeepney>=0.4.2
  Downloading jeepney-0.6.0-py3-none-any.whl (45 kB)
     |████████████████████████████████| 45 kB 2.1 MB/s 
Collecting cryptography>=2.0
  Downloading cryptography-3.3.1-cp36-abi3-manylinux2010_x86_64.whl (2.6 MB)
     |████████████████████████████████| 2.6 MB 1.6 MB/s 
Requirement already satisfied: six>=1.4.1 in /usr/lib/python3/dist-packages (from cryptography>=2.0->SecretStorage>=3.2->keyring==21.8.0) (1.14.0)
Collecting cffi>=1.12
  Downloading cffi-1.14.4-cp39-cp39-manylinux1_x86_64.whl (405 kB)
     |████████████████████████████████| 405 kB 1.6 MB/s 
Collecting pycparser
  Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
     |████████████████████████████████| 112 kB 2.4 MB/s 
Installing collected packages: pycparser, cffi, jeepney, cryptography, SecretStorage, keyring
Successfully installed SecretStorage-3.3.0 cffi-1.14.4 cryptography-3.3.1 jeepney-0.6.0 keyring-21.8.0 pycparser-2.20
root@f45a9db37817:/# pip install -U keyring
Requirement already satisfied: keyring in /usr/local/lib/python3.9/dist-packages (21.8.0)
Collecting keyring
  Downloading keyring-22.0.0-py3-none-any.whl (32 kB)
Requirement already satisfied: SecretStorage>=3.2 in /usr/local/lib/python3.9/dist-packages (from keyring) (3.3.0)
Requirement already satisfied: jeepney>=0.4.2 in /usr/local/lib/python3.9/dist-packages (from keyring) (0.6.0)
Requirement already satisfied: cryptography>=2.0 in /usr/local/lib/python3.9/dist-packages (from SecretStorage>=3.2->keyring) (3.3.1)
Requirement already satisfied: cffi>=1.12 in /usr/local/lib/python3.9/dist-packages (from cryptography>=2.0->SecretStorage>=3.2->keyring) (1.14.4)
Requirement already satisfied: six>=1.4.1 in /usr/lib/python3/dist-packages (from cryptography>=2.0->SecretStorage>=3.2->keyring) (1.14.0)
Requirement already satisfied: pycparser in /usr/local/lib/python3.9/dist-packages (from cffi>=1.12->cryptography>=2.0->SecretStorage>=3.2->keyring) (2.20)
Installing collected packages: keyring
  Attempting uninstall: keyring
    Found existing installation: keyring 21.8.0
    Uninstalling keyring-21.8.0:
      Successfully uninstalled keyring-21.8.0
Successfully installed keyring-22.0.0
root@f45a9db37817:/# pip list
Package             Version
------------------- --------------------
appdirs             1.4.4
certifi             2019.11.28
cffi                1.14.4
chardet             3.0.4
cryptography        3.3.1
dbus-python         1.2.16
distlib             0.3.1
distro-info         0.23ubuntu1
filelock            3.0.12
idna                2.8
jeepney             0.6.0
keyring             22.0.0
packaging           20.8
pip                 21.0
pip-run             8.2.1
pluggy              0.13.1
py                  1.10.0
pycparser           2.20
PyGObject           3.36.0
pyparsing           2.4.7
python-apt          2.0.0+ubuntu0.20.4.3
requests            2.22.0
requests-unixsocket 0.2.0
SecretStorage       3.3.0
setuptools          51.1.2
six                 1.14.0
toml                0.10.2
tox                 3.21.0
tox-pip-version     0.0.7
unattended-upgrades 0.1
urllib3             1.25.8
virtualenv          20.3.0
wheel               0.36.2
root@f45a9db37817:/# keyring --list-backends
keyring.backends.chainer.ChainerBackend (priority: -1)
keyring.backends.fail.Keyring (priority: 0)

Neither on macOS:

~ $ pipx upgrade keyring                                                                                                                 
~ $ ~/.local/pipx/venvs/keyring/bin/python -m pip list -o
Package    Version Latest Type
---------- ------- ------ -----
keyring    21.4.0  22.0.0 wheel
packaging  20.4    20.8   wheel
pip        20.3.3  21.0   wheel
setuptools 51.1.2  52.0.0 wheel
WARNING: You are using pip version 20.3.3; however, version 21.0 is available.
You should consider upgrading via the '/Users/jaraco/.local/pipx/venvs/keyring/bin/python -m pip install --upgrade pip' command.
~ $ pipx upgrade keyring
upgraded package keyring from 21.4.0 to 22.0.0 (location: /Users/jaraco/.local/pipx/venvs/keyring)

~ $ ~/.local/pipx/venvs/keyring/bin/python -m pip list -o
Package   Version Latest Type
--------- ------- ------ -----
packaging 20.4    20.8   wheel
~ $ keyring --list-backends
keyring.backends.fail.Keyring (priority: 0)
keyring.backends.macOS.Keyring (priority: 5)
keyring.backends.chainer.ChainerBackend (priority: -1)

The error you report indicates that there is a mismatch between metadata and the version installed (you have keyring metadata from keyring<22 with an install of keyring==22).

Furthermore, the error that's reported is logged to the screen but doesn't block the execution.

My recommendation is that you ponder further what actions could have led to the metadata mismatch. Do you have legacy metadata lingering in the environment? How did it get there?

@jaraco jaraco changed the title OS_X error when updating on Linux No module named 'keyring.backends.OS_X' after upgrade to 22 Jan 26, 2021
@gothicVI
Copy link
Author

@jaraco thanks for your reply.

Do you have legacy metadata lingering in the environment?

How could I check for that?

How did it get there?

I've no idea. I exclusively update packages via pip with the --user flag. Could it be some system package?
I've seen this issue now on two different machines. One running Linux mint, the other one running Ubuntu.

@JD-Veiga
Copy link

JD-Veiga commented Jan 26, 2021

Solved!

I have been upgrading keyring from one version to next one via pip.

For whatever reason, several versions of keyring metadata --corresponding to successive keyring versions-- have been kept in site-packages folder.

So the solution in my case was to uninstall all using sudo -H pip uninstall keyring several times until getting a WARNING: Skipping keyring as it is not installed. and re-install keyring again.

Maybe it is caused by the way I use pip (combined with macports).

At least in my case, this is no bug in keyring but in the way it was upgraded in my system.

Thank you, @jaraco for your help.

@jaraco
Copy link
Owner

jaraco commented Jan 26, 2021

How could I check for that?

Good question. You could manually scan the directories in sys.path or you could use importlib.metadata (or importlib_metadata):

>>> import importlib.metadata
>>> [dist._path for dist in importlib.metadata.distributions() if dist.metadata['name'] == 'keyring']

I simulated a situation where two different versions were installed (22 over 21.8) using pip-run:

~ $ pip-run -q keyring==21.8.0 -- -m pip-run -q keyring==22.0.0 -- -c "import importlib.metadata, pprint; pprint.pprint([dist._path for dist in importlib.metadata.distributions() if dist.metadata['name'] == 'keyring'])"
[PosixPath('/var/folders/03/7l0ffypn50b83bp0bt07xcch00n8zm/T/pip-run-a3xvd267/keyring-22.0.0.dist-info'),
 PosixPath('/var/folders/03/7l0ffypn50b83bp0bt07xcch00n8zm/T/pip-run-1fdjsgfs/keyring-21.8.0.dist-info')]

@gothicVI
Copy link
Author

@JD-Veiga that somewhat gave some insight. It seems that I have the package python3-keyring installed which provides keyring 18.0.1. Somehow, upgrading up to version 21.8.0 went flawlessly but the upgrade to version 22 not.
Given that the former version is installed via the package manager I hesitate to remove it via sudo pip.

@jaraco your suggested check after uninstalling version 22 yields

[PosixPath('/usr/lib/python3/dist-packages/keyring-18.0.1.egg-info')]

with it reinstalled - again triggering the original error message

[PosixPath('/home/sebastian/.local/lib/python3.8/site-packages/keyring-22.0.0.dist-info'), PosixPath('/usr/lib/python3/dist-packages/keyring-18.0.1.egg-info')]

which confirms your suspicion.
Do you have an idea on how to get the system-wide version out of the path?

@jaraco
Copy link
Owner

jaraco commented Jan 26, 2021

@gothicVI, that's good information. Now that I consider your use-case more, I think you may have uncovered a weakness in importlib.metadata's handling of entry points. It probably should only expose the entry points of the first project of a given name.

Using the pip-run technique to simulate the multiply-installed versions, I see the error emitted:

~ $ pip-run -q keyring==21.8.0 -- -m pip-run -q keyring==22.0.0 -- -m pip list -o
ERROR: Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.OS_X', group='keyring.backends').
Traceback (most recent call last):
  File "/var/folders/03/7l0ffypn50b83bp0bt07xcch00n8zm/T/pip-run-ihbkaz2t/keyring/backend.py", line 200, in _load_plugins
    init_func = ep.load()
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.OS_X'
ERROR: Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.OS_X', group='keyring.backends').
Traceback (most recent call last):
  File "/var/folders/03/7l0ffypn50b83bp0bt07xcch00n8zm/T/pip-run-ihbkaz2t/keyring/backend.py", line 200, in _load_plugins
    init_func = ep.load()
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.OS_X'
ERROR: Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.OS_X', group='keyring.backends').
Traceback (most recent call last):
  File "/var/folders/03/7l0ffypn50b83bp0bt07xcch00n8zm/T/pip-run-ihbkaz2t/keyring/backend.py", line 200, in _load_plugins
    init_func = ep.load()
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.OS_X'
ERROR: Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.OS_X', group='keyring.backends').
Traceback (most recent call last):
  File "/var/folders/03/7l0ffypn50b83bp0bt07xcch00n8zm/T/pip-run-ihbkaz2t/keyring/backend.py", line 200, in _load_plugins
    init_func = ep.load()
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.OS_X'
ERROR: Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.OS_X', group='keyring.backends').
Traceback (most recent call last):
  File "/var/folders/03/7l0ffypn50b83bp0bt07xcch00n8zm/T/pip-run-ihbkaz2t/keyring/backend.py", line 200, in _load_plugins
    init_func = ep.load()
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.OS_X'
ERROR: Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.OS_X', group='keyring.backends').
Traceback (most recent call last):
  File "/var/folders/03/7l0ffypn50b83bp0bt07xcch00n8zm/T/pip-run-ihbkaz2t/keyring/backend.py", line 200, in _load_plugins
    init_func = ep.load()
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.OS_X'
ERROR: Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.OS_X', group='keyring.backends').
Traceback (most recent call last):
  File "/var/folders/03/7l0ffypn50b83bp0bt07xcch00n8zm/T/pip-run-ihbkaz2t/keyring/backend.py", line 200, in _load_plugins
    init_func = ep.load()
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.OS_X'
ERROR: Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.OS_X', group='keyring.backends').
Traceback (most recent call last):
  File "/var/folders/03/7l0ffypn50b83bp0bt07xcch00n8zm/T/pip-run-ihbkaz2t/keyring/backend.py", line 200, in _load_plugins
    init_func = ep.load()
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.OS_X'
ERROR: Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.OS_X', group='keyring.backends').
Traceback (most recent call last):
  File "/var/folders/03/7l0ffypn50b83bp0bt07xcch00n8zm/T/pip-run-ihbkaz2t/keyring/backend.py", line 200, in _load_plugins
    init_func = ep.load()
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.OS_X'
ERROR: Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.OS_X', group='keyring.backends').
Traceback (most recent call last):
  File "/var/folders/03/7l0ffypn50b83bp0bt07xcch00n8zm/T/pip-run-ihbkaz2t/keyring/backend.py", line 200, in _load_plugins
    init_func = ep.load()
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/Users/jaraco/.local/homebrew/Cellar/python@3.9/3.9.1_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.OS_X'
Package  Version  Latest   Type
-------- -------- -------- -----
pipx     0.15.6.0 0.16.0.0 wheel
userpath 1.4.1    1.4.2    wheel

@jaraco
Copy link
Owner

jaraco commented Jan 26, 2021

I filed python/importlib_metadata#280 to capture the underlying weakness. In the meantime, your best bet will be to either ignore the error (it is in fact ignorable, as annoying as it is), or remove keyring from the system site-packages (with sudo apt uninstall python-keyring maybe?), or upgrade the version in system site packages.

I may consider making this module present in keyring 22 just to avoid these errors. Let me know how you fare with the recommendations above and how painful they are for your environment.

@gothicVI
Copy link
Author

gothicVI commented Jan 26, 2021

I'll follow that issue - thanks a lot!
I guess for the moment I'd downgrade keyring to version 21.8.0 until importlib.metadata takes care of the issue. Not upgrading it does not pose any issues at the moment. I guess it'll take some time until the first packages will have version 22 as a prerequisite.
EDIT: I was unaware that you're a contributor to importlib.metadata so my answer there is quite pointless ;)

@jaraco jaraco closed this as completed in 89eacd1 Jan 26, 2021
@jaraco
Copy link
Owner

jaraco commented Jan 26, 2021

I tested that commit with the repro and determined it works:

~ $ pip-run -q keyring==21.8.0 -- -m pip-run -q ~/m/keyring -- -m pip list -o
<no output>

@gothicVI
Copy link
Author

I can confirm that version 22.0.1 no longer shows the issue. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants