Rafficer / linux-cli-community

Linux command-line client for ProtonVPN. Written in Python.
https://protonvpn.com
GNU General Public License v3.0
1.29k stars 195 forks source link

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

Open tschan-its opened 3 years ago

tschan-its commented 3 years ago

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):

knormoyle commented 3 years ago

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 commented 3 years ago

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.
gzklcece commented 2 years ago

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

mediavince commented 2 years ago

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