home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 394423623

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
394423623 MDU6SXNzdWUzOTQ0MjM2MjM= 2634 Opening a file with open_mfdataset fails if dask is not installed: ModuleNotFoundError: No module named 'dask.base' 226037 closed 0     3 2018-12-27T15:33:27Z 2023-12-05T21:43:15Z 2023-12-05T21:43:15Z MEMBER      

Problem description

Opening a file with open_mfdataset fails if dask is not installed: ```

xr.open_mfdataset('tests/sample-data/era5-levels-members.nc')


ModuleNotFoundError Traceback (most recent call last) ~/devel/MPY/xarray/xarray/backends/api.py in open_mfdataset(paths, chunks, concat_dim, compat, preprocess, engine, lock, data_vars, coords, autoclose, parallel, kwargs) 626 --> 627 datasets = [open_(p, open_kwargs) for p in paths] 628 file_objs = [getattr_(ds, '_file_obj') for ds in datasets] 629 if preprocess is not None:

~/devel/MPY/xarray/xarray/backends/api.py in open_dataset(filename_or_obj, group, decode_cf, mask_and_scale, decode_times, autoclose, concat_characters, decode_coords, engine, chunks, lock, cache, drop_variables, backend_kwargs) 340 341 with close_on_error(store): --> 342 return maybe_decode_store(store) 343 else: 344 if engine is not None and engine != 'scipy':

~/devel/MPY/xarray/xarray/backends/api.py in maybe_decode_store(store, lock) 276 277 if chunks is not None: --> 278 from dask.base import tokenize 279 # if passed an actual file path, augment the token with 280 # the file modification time

ModuleNotFoundError: No module named 'dask.base' ```

Reason

The reason is that the test in maybe_decode_store is for None but open_mfdataset in line 614 sets chunks to {} if it evaluates to False.

In fact setting line https://github.com/pydata/xarray/blob/master/xarray/backends/api.py#L614 as follows solves the problem: open_kwargs = dict(engine=engine, chunks=chunks, lock=lock, autoclose=autoclose, **kwargs) I could not run the tests to see what breaks with this change as running pytest without dask fails with: ../cpython3/lib/python3.7/site-packages/py/_path/local.py:668: in pyimport __import__(modname) xarray/tests/__init__.py:105: in <module> if LooseVersion(dask.__version__) < '0.18': E AttributeError: module 'dask' has no attribute '__version__'

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2634/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  not_planned 13221727 issue

Links from other tables

  • 5 rows from issues_id in issues_labels
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 78.671ms · About: xarray-datasette