Python Xarray ValueError: unrecognized chunk manager dask - must be one of: []
Asked Answered
E

5

6

I am using xarray for combining multiple netcdf files using xarray.open_mfdataset. But I get the error while running the command, below are the commands and error.

nc_all = xarray.open_mfdataset(files,combine = 'nested', concat_dim="time")
files = glob.glob("/filepath/*")

I get the following error-

Traceback (most recent call last):
  File "/home/lsrathore/GLEAM/GLEAM_HPC.py", line 85, in <module>
    nc_1980_90 = xarray.open_mfdataset(files[1:11],combine = 'nested', concat_dim="time")
  File "/home/lsrathore/.local/lib/python3.9/site-packages/xarray/backends/api.py", line 1038, in open_mfdataset
    datasets = [open_(p, **open_kwargs) for p in paths]
  File "/home/lsrathore/.local/lib/python3.9/site-packages/xarray/backends/api.py", line 1038, in <listcomp>
    datasets = [open_(p, **open_kwargs) for p in paths]
  File "/home/lsrathore/.local/lib/python3.9/site-packages/xarray/backends/api.py", line 572, in open_dataset
    ds = _dataset_from_backend_dataset(
  File "/home/lsrathore/.local/lib/python3.9/site-packages/xarray/backends/api.py", line 367, in _dataset_from_backend_dataset
    ds = _chunk_ds(
  File "/home/lsrathore/.local/lib/python3.9/site-packages/xarray/backends/api.py", line 315, in _chunk_ds
    chunkmanager = guess_chunkmanager(chunked_array_type)
  File "/home/lsrathore/.local/lib/python3.9/site-packages/xarray/core/parallelcompat.py", line 87, in guess_chunkmanager
    raise ValueError(
ValueError: unrecognized chunk manager dask - must be one of: []

What is causing the problem?

Exterritorial answered 5/6, 2023 at 20:50 Comment(1)
This is likely a problem with your installation. See github.com/pydata/xarray/issues/7856 for more details on the problem.Retrieve
E
4

The issue was resolved when I downgraded the xarray version to 0.21.1 from 2023.5.0

Exterritorial answered 5/6, 2023 at 21:52 Comment(0)
F
3

For some unknown reason (to me), what I have found that works instead of performing any downgrade is to install all the packages needed (specially Xarray) and finally reinstall dask as:

conda install dask --force-reinstall

I have performed this in 4 environments and always has worked.

PS: I would also recommend using libmamba as the solver.

Flatiron answered 4/2 at 14:44 Comment(1)
this was still a problem for me in xarray version 2024.2.0, and forcing reinstall using mamba worked for me mamba install dask --force-reinstallPropylaeum
F
1

It works for me with the latest xarray-2023.7.0 if I install dask first: pip install dask.
The xarray downgrade tip was useful as gives a 'Module not found' error on dask rather than the convoluted error message above, but after installing dask I was able to upgrade xarray to the latest and it works fine now.

Fourway answered 9/8, 2023 at 1:26 Comment(0)
J
0

it works by downgraded the xarray version to 2022.11.0

Jobber answered 26/7, 2023 at 11:15 Comment(0)
E
0

The other suggested options here didn't work for me when accessing a zarr store hosted on Azure, but running this did:

pip install --upgrade xarray zarr dask fsspec
Est answered 8/10 at 21:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.