[BUG] No module named 'typing_extensions'
Closed this issue · 6 comments
- I've checked docs and closed issues for possible solutions.
- I can't find my issue in the FAQ.
Describe the bug
Since rich 13.9.0 has been released, when I try to upload a package with twine, I'm getting the following error:
python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
Traceback (most recent call last):
File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.9/site-packages/twine/__main__.py", line 54, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/twine/__main__.py", line 33, in main
error = cli.dispatch(sys.argv[1:])
File "/usr/local/lib/python3.9/site-packages/twine/cli.py", line 121, in dispatch
main = registered_commands[args.command].load()
File "/usr/local/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 189, in load
module = import_module(match.group('module'))
File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line [228](https://gitlab.com), in _call_with_frames_removed
File "/usr/local/lib/python3.9/site-packages/twine/commands/upload.py", line 28, in <module>
from twine import settings
File "/usr/local/lib/python3.9/site-packages/twine/settings.py", line 23, in <module>
from twine import repository
File "/usr/local/lib/python3.9/site-packages/twine/repository.py", line 19, in <module>
import rich.progress
File "/usr/local/lib/python3.9/site-packages/rich/progress.py", line 45, in <module>
from typing_extensions import Self # pragma: no cover
ModuleNotFoundError: No module named 'typing_extensions'
When I manually install typing_extensions
or when I fix rich version to 13.8.1 the problem doesn't appear.
It's pretty similar to #2979.
This specifically comes from this commit/change: 67e68f3#diff-77d13adf0fa7cbb6c2fa6adba6462b8d37e1797ab2f23229c8b6d84d7ba0fb6dR42
The project requires typing-extensions
only if python < 3.9, but this change makes it a requirement for python < 3.11.
cc: @willmcgugan for visibility
I hit the same problem via the bandit tool (the tool depends on rich). I've submitted the PR which hopefully fixes the issue and appreciate any feedback.
I hope we solved your problem.
If you like using Rich, you might also enjoy Textual
Thank you @willmcgugan for the speedy hot fix ❤️
I can confirm this has resolved our issue (using via twine).