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

pyhthon3.10: cannot import name 'Callable' from 'collections' #22

Open
dckc opened this issue Jan 18, 2024 · 3 comments
Open

pyhthon3.10: cannot import name 'Callable' from 'collections' #22

dckc opened this issue Jan 18, 2024 · 3 comments

Comments

@dckc
Copy link

dckc commented Jan 18, 2024

terminal session
$ python --version
Python 3.10.12

$ uname -a
Linux bldbox 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

$ pip install oh-my-stars
Defaulting to user installation because normal site-packages is not writeable
Collecting oh-my-stars
  Using cached oh_my_stars-1.5.1-py2.py3-none-any.whl (12 kB)
Requirement already satisfied: tinydb==3.7.0 in ./.local/lib/python3.10/site-packages (from oh-my-stars) (3.7.0)
Requirement already satisfied: ujson==1.35 in ./.local/lib/python3.10/site-packages (from oh-my-stars) (1.35)
Requirement already satisfied: github3.py==0.9.6 in ./.local/lib/python3.10/site-packages (from oh-my-stars) (0.9.6)
Requirement already satisfied: colorama==0.3.9 in ./.local/lib/python3.10/site-packages (from oh-my-stars) (0.3.9)
Requirement already satisfied: future==0.16.0 in ./.local/lib/python3.10/site-packages (from oh-my-stars) (0.16.0)
Requirement already satisfied: uritemplate.py>=0.2.0 in ./.local/lib/python3.10/site-packages (from github3.py==0.9.6->oh-my-stars) (3.0.2)
Requirement already satisfied: requests>=2.0 in ./.local/lib/python3.10/site-packages (from github3.py==0.9.6->oh-my-stars) (2.28.1)
Requirement already satisfied: idna<4,>=2.5 in ./.local/lib/python3.10/site-packages (from requests>=2.0->github3.py==0.9.6->oh-my-stars) (3.3)
Requirement already satisfied: certifi>=2017.4.17 in ./.local/lib/python3.10/site-packages (from requests>=2.0->github3.py==0.9.6->oh-my-stars) (2022.6.15)
Requirement already satisfied: charset-normalizer<3,>=2 in ./.local/lib/python3.10/site-packages (from requests>=2.0->github3.py==0.9.6->oh-my-stars) (2.1.1)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./.local/lib/python3.10/site-packages (from requests>=2.0->github3.py==0.9.6->oh-my-stars) (1.26.12)
Requirement already satisfied: uritemplate>=2.0 in ./.local/lib/python3.10/site-packages (from uritemplate.py>=0.2.0->github3.py==0.9.6->oh-my-stars) (4.1.1)
Installing collected packages: oh-my-stars
Successfully installed oh-my-stars-1.5.1

$ mystars
Traceback (most recent call last):
  File "/home/connolly/.local/bin/mystars", line 5, in <module>
    from ohmystars.__main__ import main
  File "/home/connolly/.local/lib/python3.10/site-packages/ohmystars/__main__.py", line 2, in <module>
    from .core import main
  File "/home/connolly/.local/lib/python3.10/site-packages/ohmystars/core.py", line 11, in <module>
    from github3 import login
  File "/home/connolly/.local/lib/python3.10/site-packages/github3/__init__.py", line 20, in <module>
    from .api import *
  File "/home/connolly/.local/lib/python3.10/site-packages/github3/api.py", line 11, in <module>
    from .github import GitHub, GitHubEnterprise
  File "/home/connolly/.local/lib/python3.10/site-packages/github3/github.py", line 11, in <module>
    from .auths import Authorization
  File "/home/connolly/.local/lib/python3.10/site-packages/github3/auths.py", line 12, in <module>
    from .models import GitHubCore
  File "/home/connolly/.local/lib/python3.10/site-packages/github3/models.py", line 14, in <module>
    from .session import GitHubSession
  File "/home/connolly/.local/lib/python3.10/site-packages/github3/session.py", line 4, in <module>
    from collections import Callable
ImportError: cannot import name 'Callable' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
@wolfg1969
Copy link
Owner

Thanks, will fix it

@theguly
Copy link

theguly commented Aug 18, 2024

the problem should be in the github3 library that includes Callable from collections when in recent python it is in collections.abc
given we are using 0.x and github3 is at 4.x i guess we cannot just update github3 in Pipfile/setup.py...

edit:
after a very quick test (login, -u) looks like installing latest github3.py (4.0.1) the only required change is at https://github.com/wolfg1969/oh-my-stars/blob/master/ohmystars/core.py#L106 where iter_starred() becomes starred()
cpu/memory usage during the first indexing on a fresh environment is insane and -r gets killed after a while by OOM so maybe there is something else to fix :D

@theguly
Copy link

theguly commented Aug 27, 2024

for the records, the cpu spike is caused by a nasty description, most probably a bug in tinydb.
will eventually investigate, meanwhile please see my PR that - at least for me - fixes this issue

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