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

GT4Py import error on Python 3.9.9 #577

Closed
tehrengruber opened this issue Dec 8, 2021 · 1 comment
Closed

GT4Py import error on Python 3.9.9 #577

tehrengruber opened this issue Dec 8, 2021 · 1 comment
Labels
triage: bug Something isn't working
Projects

Comments

@tehrengruber
Copy link
Contributor

tehrengruber commented Dec 8, 2021

I recently updated my machine to Python 3.9.9 resulting in this obscure error when importing gt4py:

Python 3.9.9 (main, Nov 20 2021, 21:30:06) 
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gt4py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/tille/Development/FVM_GT4Py_storage/venv/lib/python3.9/site-packages/gt4py/__init__.py", line 45, in <module>
    from . import gtscript
  File "/home/tille/Development/FVM_GT4Py_storage/venv/lib/python3.9/site-packages/gt4py/gtscript.py", line 33, in <module>
    from gt4py.stencil_builder import StencilBuilder
  File "/home/tille/Development/FVM_GT4Py_storage/venv/lib/python3.9/site-packages/gt4py/stencil_builder.py", line 21, in <module>
    from gt4py.backend.gtc_backend.defir_to_gtir import DefIRToGTIR
  File "/home/tille/Development/FVM_GT4Py_storage/venv/lib/python3.9/site-packages/gt4py/backend/__init__.py", line 19, in <module>
    from .base import *
  File "/home/tille/Development/FVM_GT4Py_storage/venv/lib/python3.9/site-packages/gt4py/backend/base.py", line 29, in <module>
    from .module_generator import (
  File "/home/tille/Development/FVM_GT4Py_storage/venv/lib/python3.9/site-packages/gt4py/backend/module_generator.py", line 31, in <module>
    from gtc import gtir
  File "/home/tille/Development/FVM_GT4Py_storage/venv/lib/python3.9/site-packages/gtc/gtir.py", line 35, in <module>
    from eve import Node, Str, SymbolName, SymbolTableTrait, field, utils
  File "/home/tille/Development/FVM_GT4Py_storage/venv/lib/python3.9/site-packages/eve/__init__.py", line 35, in <module>
    from .concepts import (
  File "/home/tille/Development/FVM_GT4Py_storage/venv/lib/python3.9/site-packages/eve/concepts.py", line 158, in <module>
    class BaseNode(pydantic.BaseModel, metaclass=NodeMetaclass):
  File "/home/tille/Development/FVM_GT4Py_storage/venv/lib/python3.9/site-packages/eve/concepts.py", line 136, in __new__
    cls = super().__new__(mcls, name, bases, namespace, **kwargs)
  File "pydantic/main.py", line 282, in pydantic.main.ModelMetaclass.__new__
  File "pydantic/typing.py", line 287, in pydantic.typing.resolve_annotations
    For use of globalns and localns see the docstring for get_type_hints().
  File "/usr/lib/python3.9/typing.py", line 292, in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
  File "/usr/lib/python3.9/typing.py", line 553, in _evaluate
    type_ = _type_check(
  File "/usr/lib/python3.9/typing.py", line 158, in _type_check
    raise TypeError(f"{arg} is not valid as type argument")
TypeError: typing.ClassVar[typing.Dict[str, eve.concepts.ImplFieldMetadataDict]] is not valid as type argument

Python 3.8 works fine on the same machine.

@tehrengruber tehrengruber added the triage: bug Something isn't working label Dec 8, 2021
@gridtoolsjenkins gridtoolsjenkins added this to Triage in GridTools Dec 8, 2021
@jdahm
Copy link
Contributor

jdahm commented Dec 17, 2021

Indeed. This is a frustrating issue related to pydantic using internals of Python that changed in the latest versions. Duplicate of #551. A new version that fixes that is being prepared, see pydantic/pydantic#3436.

@jdahm jdahm closed this as completed Dec 17, 2021
GridTools automation moved this from Triage to Done Dec 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage: bug Something isn't working
Projects
GridTools
  
Done
Development

No branches or pull requests

2 participants