Closed
Description
What happened?
After installing xarray version 2022.6.0 (currently the latest one) via pip install xarray
:
$ python -c "import xarray; print(xarray.__version__)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/packages/xarray/xa/lib/python3.9/site-packages/xarray/__init__.py", line 1, in <module>
from . import testing, tutorial
File "/packages/xarray/xa/lib/python3.9/site-packages/xarray/testing.py", line 9, in <module>
from xarray.core import duck_array_ops, formatting, utils
File "/packages/xarray/xa/lib/python3.9/site-packages/xarray/core/duck_array_ops.py", line 26, in <module>
from . import dask_array_compat, dask_array_ops, dtypes, npcompat, nputils
File "/packages/xarray/xa/lib/python3.9/site-packages/xarray/core/npcompat.py", line 72, in <module>
_SupportsDType[np.dtype],
File "/x86_64/anaconda/3/2021.11/lib/python3.9/typing.py", line 275, in inner
return func(*args, **kwds)
File "/x86_64/anaconda/3/2021.11/lib/python3.9/typing.py", line 999, in __class_getitem__
_check_generic(cls, params, len(cls.__parameters__))
File "/x86_64/anaconda/3/2021.11/lib/python3.9/typing.py", line 209, in _check_generic
raise TypeError(f"{cls} is not a generic class")
TypeError: <class 'numpy.typing._dtype_like._SupportsDType'> is not a generic class
My environment includes numpy 1.20.3 which satisfies the minimal requirements in setup.cfg. On the other hand, updating it to version 1.21.0 or downgrading it to 1.19.0 solves the problem.
What did you expect to happen?
Successful import of xarray
Minimal Complete Verifiable Example
python -m venv test
source test/bin/activate
pip install numpy==1.20.0
pip install xarray==2022.06.0
python -c "import xarray"
MVCE confirmation
- Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
- Complete example — the example is self-contained, including all data and the text of any traceback.
- Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
- New issue — a search of GitHub Issues suggests this is not a duplicate.
Relevant log output
No response
Anything else we need to know?
No response