pangeo-data / xESMF

Universal Regridder for Geospatial Data
http://xesmf.readthedocs.io/
MIT License
182 stars 32 forks source link

TypeError: `ABCMeta` object is not subscriptable #361

Closed amhayes231 closed 1 month ago

amhayes231 commented 1 month ago

Python Version: 3.8.0 xarray Version: 2023.1.0 xesmf Version: 0.8.5

Distribution: EndeavourOS

When trying to import xesmf, I get the following error:

Traceback (most recent call last):
  File "xesmf_test.py", line 2, in <module>
    import xesmf as xe
  File "/home/adamh/vs_venv_p3.8/.venv/lib/python3.8/site-packages/xesmf/__init__.py", line 4, in <module>
    from .frontend import Regridder, SpatialAverager
  File "/home/adamh/vs_venv_p3.8/.venv/lib/python3.8/site-packages/xesmf/frontend.py", line 7, in <module>
    import cf_xarray as cfxr
  File "/home/adamh/vs_venv_p3.8/.venv/lib/python3.8/site-packages/cf_xarray/__init__.py", line 2, in <module>
    from .accessor import CFAccessor  # noqa
  File "/home/adamh/vs_venv_p3.8/.venv/lib/python3.8/site-packages/cf_xarray/accessor.py", line 29, in <module>
    from .criteria import (
  File "/home/adamh/vs_venv_p3.8/.venv/lib/python3.8/site-packages/cf_xarray/criteria.py", line 17, in <module>
    cf_role_criteria: Mapping[str, Mapping[str, str]] = {
TypeError: 'ABCMeta' object is not subscriptable

Any support on how to combat this?

aulemahal commented 1 month ago

Hi @amhayes231, this error seems to stem from cf-xarray rather than from xESMF, so you could maybe open an issue there.

From a quick Stackoverflow search, it looks like a python version issue. Try upgrading to python >= 3.9 if possible. However, we test against all python version and our python 3.8 run does not show this error. In that CI run we have xarray 2023.1.0 and cf-xarray 0.8.4, if that can help.

EDIT : Oh I see you have python 3.8.0, if python 3.8 is important for you, try to at least update to the latest patch. Our successful tests use 3.8.19.