Skip to content

import xarray fails with numpy 1.20.x #6957

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

Closed
2 of 4 tasks
pierocor opened this issue Aug 26, 2022 · 2 comments
Closed
2 of 4 tasks

import xarray fails with numpy 1.20.x #6957

pierocor opened this issue Aug 26, 2022 · 2 comments

Comments

@pierocor
Copy link

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

Environment

@pierocor pierocor added bug needs triage Issue that has not been reviewed by xarray team member labels Aug 26, 2022
@andersy005
Copy link
Member

Duplicate of:

which seems to have been addressed (if you use the main branch).

@andersy005 andersy005 added duplicate needs triage Issue that has not been reviewed by xarray team member and removed needs triage Issue that has not been reviewed by xarray team member bug labels Aug 26, 2022
@pierocor
Copy link
Author

Sorry, I missed that issue. Thanks for the fast reply!

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

No branches or pull requests

2 participants