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

numpy 1.21 generates issue with importing xarray #19310

Closed
TiemoMathijssen opened this issue Jun 23, 2021 · 2 comments · Fixed by #19311
Closed

numpy 1.21 generates issue with importing xarray #19310

TiemoMathijssen opened this issue Jun 23, 2021 · 2 comments · Fixed by #19311
Labels
32 - Installation Problems installing or compiling NumPy Static typing

Comments

@TiemoMathijssen
Copy link

After installing numpy v1.21, I have a problem importing xarray 0.18.2 in python3.7.9. This problem does not occur using numpy v1.20.3.

Steps to reproduce:

Numpy and xarray libraries are installed using pip3 install

Error message:

Python 3.7.9 (default, Apr 30 2021, 20:11:56)
[GCC 7.3.1 20180712 (Red Hat 7.3.1-12)] on linux
Type "help", "copyright", "credits" or "license" for more information.

import xarray
Traceback (most recent call last):
File "", line 1, in
File "/home/rainbow/.local/lib/python3.7/site-packages/xarray/init.py", line 3, in
from . import testing, tutorial, ufuncs
File "/home/rainbow/.local/lib/python3.7/site-packages/xarray/testing.py", line 8, in
from xarray.core import duck_array_ops, formatting, utils
File "/home/rainbow/.local/lib/python3.7/site-packages/xarray/core/duck_array_ops.py", line 16, in
from . import dask_array_compat, dask_array_ops, dtypes, npcompat, nputils
File "/home/rainbow/.local/lib/python3.7/site-packages/xarray/core/npcompat.py", line 81, in
from numpy.typing import ArrayLike, DTypeLike
File "/home/rainbow/.local/lib/python3.7/site-packages/numpy/typing/init.py", line 315, in
from ._shape import _Shape, _ShapeLike
File "/home/rainbow/.local/lib/python3.7/site-packages/numpy/typing/_shape.py", line 15, in
_ShapeLike = Union[SupportsIndex, Sequence[SupportsIndex]]
File "/usr/lib64/python3.7/typing.py", line 254, in inner
return func(*args, **kwds)
File "/usr/lib64/python3.7/typing.py", line 634, in getitem
params = tuple(_type_check(p, msg) for p in params)
File "/usr/lib64/python3.7/typing.py", line 634, in
params = tuple(_type_check(p, msg) for p in params)
File "/usr/lib64/python3.7/typing.py", line 142, in _type_check
raise TypeError(f"{msg} Got {arg!r:.100}.")
TypeError: Parameters to generic types must be types. Got NotImplemented.

@BvB93
Copy link
Member

BvB93 commented Jun 23, 2021

Hi @TiemoMathijssen,
A fix for the issue is currently up at #19311 and should be in the next release.

In the meantime there two possible ways of remedying the situation:

@BvB93 BvB93 added this to the 1.21.1 release milestone Jun 23, 2021
@BvB93
Copy link
Member

BvB93 commented Jun 23, 2021

Not sure why this wasn't automatically closed by merging the linked PR.
In any case, closed by #19311.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
32 - Installation Problems installing or compiling NumPy Static typing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants