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

ModuleNotFoundError: No module named 'typing_extensions' #1945

Closed
oerp-odoo opened this issue Jan 8, 2023 · 4 comments · Fixed by #1944
Closed

ModuleNotFoundError: No module named 'typing_extensions' #1945

oerp-odoo opened this issue Jan 8, 2023 · 4 comments · Fixed by #1944
Milestone

Comments

@oerp-odoo
Copy link

oerp-odoo commented Jan 8, 2023

Steps to reproduce

  1. run pylint as pre-commit (using pre-commit/[email protected] on github actions)

Current behavior

Check for Odoo modules using pylint......................................Failed
- hook id: pylint_odoo
- exit code: 1
Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/pylint/__init__.py", line 32, in run_pylint
    from pylint.lint import Run as PylintRun
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/pylint/lint/__init__.py", line 19, in <module>
    from pylint.config.exceptions import ArgumentPreprocessingError
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/pylint/config/__init__.py", line 25, in <module>
    from pylint.config.arguments_provider import UnsupportedAction
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/pylint/config/arguments_provider.py", line 15, in <module>
    from pylint.config.arguments_manager import _ArgumentsManager
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/pylint/config/arguments_manager.py", line 25, in <module>
    from pylint import utils
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/pylint/utils/__init__.py", line 9, in <module>
    from pylint.utils.ast_walker import ASTWalker
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 13, in <module>
    from astroid import nodes
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/astroid/__init__.py", line 46, in <module>
    from astroid import inference, raw_building
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/astroid/inference.py", line 18, in <module>
    from astroid import bases, constraint, decorators, helpers, nodes, protocols, util
  File "/home/runner/.cache/pre-commit/repony02cj9v/py_env-python3/lib/python3.10/site-packages/astroid/constraint.py", line 19, in <module>
    from typing_extensions import Self
ModuleNotFoundError: No module named 'typing_extensions'

Expected behavior

Should use astroid without exception being raised

pre-commit hook:

  - repo: https://github.com/OCA/pylint-odoo
    rev: v8.0.17
    hooks:
      - id: pylint_odoo
        args:
          - --rcfile=.pylintrc-mandatory
        files: ^src/ # only check Odoo code

Looks like the issue is because of this recent change: https://github.com/PyCQA/astroid/blame/6d936e8d29aa4eb45f55e2c42652715f26d73599/astroid/constraint.py#L19

Not sure how requirements are handled exactly there, but requirements_test_min.txt has typing-extension, yet requirements_test_pre_commit.txt does not. If pre-commit requirements one is only used to set up dependencies, this might be the problem?

@Pierre-Sassoulas
Copy link
Member

Thank you for opening the issue. requirements_test_min.txt is used only in our continuous integration, so it was hiding the issue. With #1944 the CI correctly fail now.

@oerp-odoo
Copy link
Author

I see, thanks for clarification

Pierre-Sassoulas added a commit that referenced this issue Jan 8, 2023
Also fix the version check for 'typing-extensions' dependency in order to fix #1945
github-actions bot pushed a commit that referenced this issue Jan 8, 2023
Also fix the version check for 'typing-extensions' dependency in order to fix #1945

(cherry picked from commit 19878a5)
Pierre-Sassoulas added a commit that referenced this issue Jan 8, 2023
Also fix the version check for 'typing-extensions' dependency in order to fix #1945

(cherry picked from commit 19878a5)

Co-authored-by: Pierre Sassoulas <[email protected]>
@Pierre-Sassoulas
Copy link
Member

It was released in astroid 2.13.2, please update if you encounter the issue.

@oerp-odoo
Copy link
Author

@Pierre-Sassoulas thanks, its working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants