[Bug]: `cf_xarray<0.7.3` + `xarray>=2022.6.0` breaks with `AttributeError: module 'xarray.core' has no attribute 'resample'`
tomvothecoder opened this issue · 0 comments
tomvothecoder commented
I totally forgot to open up this issue last September, but I wanted to keep it on record in this repo.
In this xCDAT issue , a user found thatcf_xarray=0.7.0
breaks if xarray>=2022.6.0
is installed due to the import of module xr.core.resample.Resample
. Maybe this module was moved to another location in the xarray codebase in that version?
Solution
- Direct user solution: upgrade/install
cf_xarray >=0.7.3
(this is what we found to work) - Developer solution: maybe a patch to constrain
xarray>=2022.6.0
in the conda-forge feedstock?
Minimum example
Create and activate the environment (conda or mamba)
mamba create -n cf-xarray-bug cf_xarray=0.7.0 xarray=2022.6.0
mamba activate cf-xarray-bug
python
import cf_xarray
Log Output
>>> import cf_xarray
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/global/homes/v/vo13/mambaforge/envs/cf-xarray-bug/lib/python3.11/site-packages/cf_xarray/__init__.py", line 1, in <module>
from .accessor import CFAccessor # noqa
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/global/homes/v/vo13/mambaforge/envs/cf-xarray-bug/lib/python3.11/site-packages/cf_xarray/accessor.py", line 41, in <module>
xr.core.resample.Resample,
^^^^^^^^^^^^^^^^
AttributeError: module 'xarray.core' has no attribute 'resample'