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

[Bug]: Can't import xcdat after updating from 0.3.0 to 0.5.0 (module 'xarray.core' has no attribute 'resample') #543

Closed
jypeter opened this issue Sep 14, 2023 · 4 comments · Fixed by #547
Assignees
Labels
type: bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@jypeter
Copy link

jypeter commented Sep 14, 2023

What happened?

I have updated xcdat using mamba the following way

(cdatm_py3) jypeter@obelix4 - ...jypeter - 45 >mamba update xcdat
[...]

Pinned packages:
  - python 3.8.*


Transaction

  Prefix: /home/share/unix_files/cdat/miniconda3_21-02/envs/cdatm_py3

  Updating specs:

   - xcdat
   - ca-certificates
   - certifi
   - openssl


  Package    Version  Build           Channel                   Size
──────────────────────────────────────────────────────────────────────
  Install:
──────────────────────────────────────────────────────────────────────

  + libxslt   1.1.33  hf705e74_1      conda-forge/linux-64     553kB
  + lxml       4.8.0  py38h0a891b7_3  conda-forge/linux-64       2MB

  Upgrade:
──────────────────────────────────────────────────────────────────────

  - openssl   1.1.1v  hd590300_0      installed
  + openssl   1.1.1w  hd590300_0      conda-forge/linux-64       2MB
  - xcdat      0.3.0  pyhd8ed1ab_0    installed
  + xcdat      0.5.0  pyhd8ed1ab_0    conda-forge/noarch        61kB

  Summary:

  Install: 2 packages
  Upgrade: 2 packages

  Total download: 4MB

──────────────────────────────────────────────────────────────────────

Confirm changes: [Y/n] Y
lxml                                                 1.5MB @   4.9MB/s  0.3s
libxslt                                            553.1kB @   1.7MB/s  0.3s
openssl                                              2.0MB @   5.7MB/s  0.4s
xcdat                                               61.0kB @ 128.9kB/s  0.5s
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

Afterwards, I can't import xcdat anymore

(cdatm_py3) jypeter@obelix4 - ...jypeter - 46 >python
Python 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 16:22:27)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xcdat
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/share/unix_files/cdat/miniconda3_21-02/envs/cdatm_py3/lib/python3.8/site-packages/xcdat/__init__.py", line 2, in <module>
    from xcdat.axis import (  # noqa: F401
  File "/home/share/unix_files/cdat/miniconda3_21-02/envs/cdatm_py3/lib/python3.8/site-packages/xcdat/axis.py", line 9, in <module>
    from cf_xarray.criteria import coordinate_criteria
  File "/home/share/unix_files/cdat/miniconda3_21-02/envs/cdatm_py3/lib/python3.8/site-packages/cf_xarray/__init__.py", line 1, in <module>
    from .accessor import CFAccessor  # noqa
  File "/home/share/unix_files/cdat/miniconda3_21-02/envs/cdatm_py3/lib/python3.8/site-packages/cf_xarray/accessor.py", line 42, in <module>
    xr.core.resample.Resample,
AttributeError: module 'xarray.core' has no attribute 'resample'

What did you expect to happen? Are there are possible answers you came across?

I expected xcdat to keep on working after the update :-)

Minimal Complete Verifiable Example (MVCE)

No response

Relevant log output

No response

Anything else we need to know?

What is the suggested way to update xcdat?
I have not found anything about that in the documentation

Environment

import xarray as xr
xr.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 16:22:27)
[GCC 9.3.0]
python-bits: 64
OS: Linux
OS-release: 3.10.0-1160.83.1.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.10.6
libnetcdf: 4.7.4

xarray: 2022.9.0
pandas: 1.2.3
numpy: 1.21.4
scipy: 1.7.0
netCDF4: 1.5.6
pydap: None
h5netcdf: 0.13.1
h5py: 2.10.0
Nio: None
zarr: 2.11.0
cftime: 1.6.2
nc_time_axis: 1.4.1
PseudoNetCDF: None
rasterio: None
cfgrib: 0.9.9.0
iris: 3.1.0
bottleneck: 1.3.7
dask: 2021.02.0
distributed: 2021.02.0
matplotlib: 3.3.4
cartopy: 0.18.0
seaborn: 0.11.1
numbagg: None
fsspec: 0.8.7
cupy: None
pint: 0.20.1
sparse: 0.13.0
flox: 0.7.2
numpy_groupies: 0.9.22
setuptools: 49.6.0.post20210108
pip: 22.0.4
conda: None
pytest: 6.2.4
IPython: 7.21.0
sphinx: 3.5.2

@jypeter jypeter added the type: bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Sep 14, 2023
@jypeter
Copy link
Author

jypeter commented Sep 14, 2023

I have just found #341 !

Maybe #341 should not have been closed before exploring A few things we might want to consider on our end @tomvothecoder mentioned at the end? Because we are just 1 year after the issue was reported and the issue is still occurring

xr.show_versions() does not report cf_xarray version. It appears I have an even older version (0.6.1) than the one mentioned in the original issue (0.7.0)

I have updated cf_xarray and I can import xcdat again! You may want to do something about this, even if it is likely that not many people around have an old version of xcdat and cf_xarray

(cdatm_py3) jypeter@obelix4 - ...jypeter - 48 >mamba update cf_xarray
[...]
  Package      Version  Build         Channel                Size
───────────────────────────────────────────────────────────────────
  Upgrade:
───────────────────────────────────────────────────────────────────

  - cf_xarray    0.6.1  pyh6c4a22f_0  installed
  + cf_xarray    0.8.4  pyhd8ed1ab_0  conda-forge/noarch     53kB

  Summary:

  Upgrade: 1 packages

  Total download: 53kB

───────────────────────────────────────────────────────────────────

Confirm changes: [Y/n] Y
cf_xarray                                           53.3kB @ 325.9kB/s  0.2s
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(cdatm_py3) jypeter@obelix4 - ...jypeter - 49 >python
Python 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 16:22:27)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xcdat
>>>

@tomvothecoder
Copy link
Collaborator

tomvothecoder commented Sep 14, 2023

Thanks @jypeter! I accidentally closed the issue by linking it to a PR merge and forgot to go back and open an issue to constrain cf_xarray.

I'll patch the v0.5.0 release to ensure this doesn't happen.

@tomvothecoder tomvothecoder self-assigned this Sep 14, 2023
@tomvothecoder
Copy link
Collaborator

tomvothecoder commented Sep 14, 2023

I accidentally closed the issue by linking it to a PR merge and forgot to go back and open an issue to constrain cf_xarray.

Actually the user who opened the issue closed the issue and I forgot to go back to it :(

@tomvothecoder
Copy link
Collaborator

I opened up an issue in the cf-xarray repo so they can possibly address it on their end.

In an hour or so, there will be a new version of v0.5.0 on conda-forge that includes this patch from this PR.

python: 3.8.8 | packaged by conda-forge | (default, Feb 20 2021, 16:22:27)

I also suggest you update your environments to at least python >=3.10. Python 3.8 is approaching end-of-life (https://devguide.python.org/versions/).

@tomvothecoder tomvothecoder added this to the v0.6.0 milestone Sep 27, 2023
@tomvothecoder tomvothecoder moved this from Todo to Done in xCDAT Development Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants