libgit2 / pygit2

Python bindings for libgit2
https://www.pygit2.org/
Other
1.58k stars 382 forks source link

cannot import name 'cached_property' from 'functools' #1114

Closed white-gecko closed 2 years ago

white-gecko commented 2 years ago

In python 3.7 I get the following traceback when using pygit2, could this be due to the changes in #1066 resp. 8ce2c901b6246d479b3ac88d7c705e8c37adae0a

Traceback (most recent call last):
  File "/home/runner/.cache/pypoetry/virtualenvs/quit-xH2r1vIa-py3.7/lib/python3.7/site-packages/pygit2/config.py", line 27, in <module>
    from functools import cached_property
ImportError: cannot import name 'cached_property' from 'functools' (/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/functools.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tests/test_app.py", line 7, in <module>
    from pygit2 import GIT_SORT_TOPOLOGICAL, Signature, GIT_OBJ_BLOB
  File "/home/runner/.cache/pypoetry/virtualenvs/quit-xH2r1vIa-py3.7/lib/python3.7/site-packages/pygit2/__init__.py", line 36, in <module>
    from .config import Config
  File "/home/runner/.cache/pypoetry/virtualenvs/quit-xH2r1vIa-py3.7/lib/python3.7/site-packages/pygit2/config.py", line 29, in <module>
    from cached_property import cached_property
ModuleNotFoundError: No module named 'cached_property'
white-gecko commented 2 years ago

I could find that cached-property is actually present in the setup.py

https://github.com/libgit2/pygit2/blob/6fecb61a9563978d3c0fa907fca010982c29fed4/setup.py#L137-L138

Also it works for me to be installed as a dependency when I install it with pip, but there are problems, when installing it with poetry in my case.

jdavid commented 2 years ago

Closing as dup of issue #1128 where @ksmanis has identified the issue.