jaraco / keyring

MIT License
1.24k stars 156 forks source link

Cannot "import keyring" on Python 3.10 ver 23.5.0. #559

Closed MoElaSec closed 2 years ago

MoElaSec commented 2 years ago

I installed keyring by: pip install keyring

then inside a REPL I'm not able to import it:

>>> import keyring
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named keyring

Environment

$ sw_vers 
ProductName:    macOS
ProductVersion: 12.1
BuildVersion:           21C52

software versions:

$ python3 --version
Python 3.10.2

...
$  pip --version                                     
pip 21.3.1
$ pip list | grep keyring
keyring            23.5.0

...
$ keyring --list-backends
keyring.backends.chainer.ChainerBackend (priority: -1)
keyring.backends.macOS.Keyring (priority: 5)
keyring.backends.fail.Keyring (priority: 0)

Additional context Add any other context about the problem here.

jaraco commented 2 years ago

It works just fine for me in a mac M1 environment:

jaraco@minamoto ~ % sw_vers
ProductName:    macOS
ProductVersion: 12.2
BuildVersion:   21D49
jaraco@minamoto ~ % pip-run -q keyring -- -c "import keyring"
jaraco@minamoto ~ % pip-run -q keyring      
Python 3.10.2 (v3.10.2:a58ebcc701, Jan 13 2022, 14:50:16) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import keyring
>>> 

I'll need you to investigate your environment to determine where the import is failing. Maybe try running with python -v.

amydentremont commented 2 years ago

This is happening for me too on python 3.10, the failure is here https://github.com/philipn/python-keyring-lib/blame/master/keyring/util/properties.py#L1. On 3.9 you get a deprecation warning saying this will stop working in 3.10

>>> from collections import Callable
<stdin>:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
jaraco commented 2 years ago

Hi Amy. What you have is a very old version of keyring. You've linked to a fork of this project with stale code. The issue you're describing was fixed in 2d47daf6f0659adcb0c4c9ccbd89ed795a88335f, released with keyring 15.