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

ONNXscript does not work with typing_extensions < 4.10 #1996

Closed
Johansmm opened this issue Jan 6, 2025 · 2 comments · Fixed by #2002
Closed

ONNXscript does not work with typing_extensions < 4.10 #1996

Johansmm opened this issue Jan 6, 2025 · 2 comments · Fixed by #2002
Assignees
Labels
contribution welcome We welcome code contributions for this

Comments

@Johansmm
Copy link
Contributor

Johansmm commented Jan 6, 2025

When I install the following packages:

pip install `typing_extensions==4.9` # Force to raise the error
pip install onnxscript

An error is raised trying to import onnxscript:

import onnxscript
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.11/dist-packages/onnxscript/__init__.py", line 64, in <module>
    from .backend.onnx_export import export2python as proto2python
  File "/usr/local/lib/python3.11/dist-packages/onnxscript/backend/onnx_export.py", line 12, in <module>
    import onnxscript.onnx_types
  File "/usr/local/lib/python3.11/dist-packages/onnxscript/onnx_types.py", line 12, in <module>
    import onnxscript.ir
  File "/usr/local/lib/python3.11/dist-packages/onnxscript/ir/__init__.py", line 81, in <module>
    from onnxscript.ir import convenience, passes, serde, traversal
  File "/usr/local/lib/python3.11/dist-packages/onnxscript/ir/convenience.py", line 14, in <module>
    from onnxscript.ir._convenience import (
  File "/usr/local/lib/python3.11/dist-packages/onnxscript/ir/_convenience.py", line 23, in <module>
    from onnxscript.ir import _core, _enums, _protocols, serde, tensor_adapters
  File "/usr/local/lib/python3.11/dist-packages/onnxscript/ir/_core.py", line 41, in <module>
    from typing_extensions import TypeIs
ImportError: cannot import name 'TypeIs' from 'typing_extensions' (/usr/local/lib/python3.11/dist-packages/typing_extensions.py)

Note this is fixed if typing_extensions>4.9 but this should be a requirement when installing the package.

@justinchuby
Copy link
Collaborator

Thanks - would you like to create a PR to add the requirement in pyproject.toml?

@justinchuby justinchuby added the contribution welcome We welcome code contributions for this label Jan 6, 2025
@Johansmm
Copy link
Contributor Author

Johansmm commented Jan 7, 2025

Yes, I can make it :)

justinchuby pushed a commit that referenced this issue Jan 8, 2025
'TypeIs' is available from `typing_extensions` v4.10.
Close #1996
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome We welcome code contributions for this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants