linux-cli-community icon indicating copy to clipboard operation
linux-cli-community copied to clipboard

[BUG] ModuleNotFoundError: No module named 'keyring.backends.macOS'

Open tschan-its opened this issue 3 years ago • 4 comments

Describe the bug Since upgrade to Python 3.9.1+ i get the message ModuleNotFoundError for 'keyring.backends.macOS. But the CLI still connects and works as usual.

To Reproduce Steps to reproduce the behavior:

  1. run protonvpn-cli --version or protonvpn-cli c -f
  2. See error

Expected behavior It should run without message.

Error Messages/Program Output/Log Messages (~/.pvpn-cli/pvpn-cli.log) Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.macOS', group='keyring.backends'). Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/keyring/backend.py", line 202, in _load_plugins init_func = ep.load() File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load module = import_module(match.group('module')) File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 984, in _find_and_load_unlocked ModuleNotFoundError: No module named 'keyring.backends.macOS'

Desktop (please complete the following information):

  • OS: Debian Testing Bullseye
  • Python Version: 3.9.1+
  • ProtonVPN-CLI Version: v3.2.1 (protonvpn-nm-lib v0.3.0; proton-client v0.2.0)

tschan-its avatar Jan 30 '21 13:01 tschan-its

I saw similar error today when doing a pip uninstall of PyGObject

$ python --version Python 3.9.0+

$ pip --version pip 20.1.1 from /usr/lib/python3/dist-packages/pip (python 3.9)

$ lsb_release -a Description: Ubuntu 20.10 Codename: groovy

$ echo "n" | pip uninstall PyGObject Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.macOS', group='keyring.backends'). Traceback (most recent call last): File "/usr/lib/python3/dist-packages/keyring/backend.py", line 203, in _load_plugins init_func = ep.load() File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load module = import_module(match.group('module')) File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 984, in _find_and_load_unlocked ModuleNotFoundError: No module named 'keyring.backends.macOS' Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.macOS', group='keyring.backends'). Traceback (most recent call last): File "/usr/lib/python3/dist-packages/keyring/backend.py", line 203, in _load_plugins init_func = ep.load() File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load module = import_module(match.group('module')) File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 984, in _find_and_load_unlocked ModuleNotFoundError: No module named 'keyring.backends.macOS'

knormoyle avatar Feb 01 '21 21:02 knormoyle

I think this got rid of the problem for me

Permanently configure the Null keyring for the user

to see possible keyring locations

python -c "import keyring.util.platform_; print(keyring.util.platform_.config_root())"
python -c "import keyring.util.platform_; print(keyring.util.platform_.data_root())"

examine config first

cat ~/.config/python_keyring/keyringrc.cfg
cat ~/.local/share/python_keyring/keyringrc.cfg

keyring --disable 
# or
python -m keyring --disable

# now should have null
cat ~/.config/python_keyring/keyringrc.cfg
cat ~/.local/share/python_keyring/keyringrc.cfg

# example
# [backend]
# default-keyring=keyring.backends.null.Keyring

# This approach affects all uses of keyring for that user.

knormoyle avatar Feb 01 '21 21:02 knormoyle

I think this got rid of the problem for me

Permanently configure the Null keyring for the user

to see possible keyring locations

python -c "import keyring.util.platform_; print(keyring.util.platform_.config_root())"
python -c "import keyring.util.platform_; print(keyring.util.platform_.data_root())"

examine config first

cat ~/.config/python_keyring/keyringrc.cfg
cat ~/.local/share/python_keyring/keyringrc.cfg

keyring --disable 
# or
python -m keyring --disable

# now should have null
cat ~/.config/python_keyring/keyringrc.cfg
cat ~/.local/share/python_keyring/keyringrc.cfg

# example
# [backend]
# default-keyring=keyring.backends.null.Keyring

# This approach affects all uses of keyring for that user.

Hi,

I got stuck when examine the config. It reports No such file or directory. But I copied and pasted it from the terminal. Could you please help me with this? Many thanks!!

image

gzklcece avatar Nov 10 '21 16:11 gzklcece

just pip uninstall and pip install the ones that bug in the logs

mediavince avatar Jul 12 '22 14:07 mediavince