diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 81ef2cd9e17..9f575027b4f 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -33,6 +33,8 @@ New Features Bug fixes ~~~~~~~~~ +- Fixed a bug in backend caused by basic installation of Dask (:issue:`4164`, :pull:`4318`) + `Sam Morley `_. Documentation diff --git a/xarray/backends/locks.py b/xarray/backends/locks.py index 435690f2079..bb876a432c8 100644 --- a/xarray/backends/locks.py +++ b/xarray/backends/locks.py @@ -72,12 +72,15 @@ def _get_scheduler(get=None, collection=None) -> Optional[str]: dask.base.get_scheduler """ try: - import dask # noqa: F401 + # Fix for bug caused by dask installation that doesn't involve the toolz library + # Issue: 4164 + import dask + from dask.base import get_scheduler # noqa: F401 + + actual_get = get_scheduler(get, collection) except ImportError: return None - actual_get = dask.base.get_scheduler(get, collection) - try: from dask.distributed import Client