xarray-contrib / cupy-xarray

Interface for using cupy in xarray, providing convenience accessors.
https://cupy-xarray.readthedocs.io
Apache License 2.0
68 stars 12 forks source link

cupy_xarray import broken #50

Closed openSourcerer9000 closed 2 months ago

openSourcerer9000 commented 3 months ago

The lib seems unusable currently:

import cupy as cp import numpy as np import xarray as xr import cupy_xarray # Adds .cupy to Xarray objects

..Lib\site-packages\cupy_xarray\accessors.py:8
      [1](file:///.../Lib/site-packages/cupy_xarray/accessors.py:1) import cupy as cp
      [2](file:///.../Lib/site-packages/cupy_xarray/accessors.py:2) from xarray import (
      [3](file:///.../Lib/site-packages/cupy_xarray/accessors.py:3)     DataArray,
      [4](file:///.../Lib/site-packages/cupy_xarray/accessors.py:4)     Dataset,
      [5](file:///.../Lib/site-packages/cupy_xarray/accessors.py:5)     register_dataarray_accessor,
      [6](file:///.../Lib/site-packages/cupy_xarray/accessors.py:6)     register_dataset_accessor,
      [7](file:///.../Lib/site-packages/cupy_xarray/accessors.py:7) )
----> [8](file:///.../Lib/site-packages/cupy_xarray/accessors.py:8) from xarray.core.pycompat import DuckArrayModule
     [10](file:///.../Lib/site-packages/cupy_xarray/accessors.py:10) dsk = DuckArrayModule("dask")
     [11](file:///.../Lib/site-packages/cupy_xarray/accessors.py:11) dask_array_type = dsk.type

ModuleNotFoundError: No module named 'xarray.core.pycompat'

for versions

cuda-version 11.8 h70ddcb2_3 conda-forge cudatoolkit 11.8.0 h09e9e62_13 conda-forge cupy 13.2.0 py311h0508009_0 conda-forge cupy-core 13.2.0 py311ha6d0cfe_0 conda-forge cupy-xarray 0.1.3 pyhd8ed1ab_0 conda-forge dask 2024.4.0 pyhd8ed1ab_0 conda-forge dask-core 2024.4.0 pyhd8ed1ab_0 conda-forge dask-expr 1.0.9 pyhd8ed1ab_0 conda-forge xarray 2024.3.0 pyhd8ed1ab_0 conda-forge

weiji14 commented 3 months ago

Ah yes, xarray 2024.3.0 (or maybe an earlier version) has moved that xarray.core.pycompat module to somewhere else. We've just fixed this bug in https://github.com/xarray-contrib/cupy-xarray/pull/46, so you could either try pip install git+https://github.com/xarray-contrib/cupy-xarray.git@791c62d949c8f311d19d90ef6b3f0a0fb58fc43a, or wait for the next bugfix release (cupy-xarray v0.1.4).

keewis commented 2 months ago

closed by #46