ImportError: cannot import name 'TypeGuard' from 'typing_extensions'
m50008 opened this issue · comments
Hi, since today I am not able to get foolbox to work.
After installing foolbox with pip, I get the following error while importing foolbox.
I tried installing TypeGuard and typing_extensions manualy but this did not fix my problem.
Any idea why this error apears and how to resolve it?
/usr/local/lib/python3.7/dist-packages/foolbox/__init__.py in <module>()
36 from . import attacks # noqa: F401
37
---> 38 from . import zoo # noqa: F401
39
40 from . import gradient_estimators # noqa: F401
/usr/local/lib/python3.7/dist-packages/foolbox/zoo/__init__.py in <module>()
----> 1 from .zoo import get_model # noqa: F401
2 from .weights_fetcher import fetch_weights # noqa: F401
3 from .git_cloner import GitCloneError # noqa: F401
4 from .model_loader import ModelLoader # noqa: F401
/usr/local/lib/python3.7/dist-packages/foolbox/zoo/zoo.py in <module>()
3 from ..models import Model
4
----> 5 from .git_cloner import clone
6 from .model_loader import ModelLoader
7
/usr/local/lib/python3.7/dist-packages/foolbox/zoo/git_cloner.py in <module>()
1 import os
2 import shutil
----> 3 from git import Repo
4 import logging
5 from .common import sha256_hash, home_directory_path
/usr/local/lib/python3.7/dist-packages/git/__init__.py in <module>()
6 # flake8: noqa
7 #@PydevCodeAnalysisIgnore
----> 8 from git.exc import * # @NoMove @IgnorePep8
9 import inspect
10 import os
/usr/local/lib/python3.7/dist-packages/git/exc.py in <module>()
8 from gitdb.exc import BadName # NOQA @UnusedWildImport skipcq: PYL-W0401, PYL-W0614
9 from gitdb.exc import * # NOQA @UnusedWildImport skipcq: PYL-W0401, PYL-W0614
---> 10 from git.compat import safe_decode
11
12 # typing ----------------------------------------------------
/usr/local/lib/python3.7/dist-packages/git/compat.py in <module>()
30 overload,
31 )
---> 32 from git.types import TBD
33
34 # ---------------------------------------------------------------------------
/usr/local/lib/python3.7/dist-packages/git/types.py in <module>()
16 from typing import TypeGuard # noqa: F401
17 else:
---> 18 from typing_extensions import TypeGuard # noqa: F401
19
20
ImportError: cannot import name 'TypeGuard' from 'typing_extensions' (/usr/local/lib/python3.7/dist-packages/typing_extensions.py)
This error isn't being thrown by Foolbox itself but by one of our dependencies, GitPython
.
As a quick fix, maybe try installing an older version of that, e.g. python3 -m pip install GitPython==3.0.7
.
Does that help?
This error isn't being thrown by Foolbox itself but by one of our dependencies,
GitPython
.
As a quick fix, maybe try installing an older version of that, e.g.python3 -m pip install GitPython==3.0.7
.
Does that help?
Thanks for the advice. Yes, this helps!