dask: ImportError: No module named 'toolz' on default install

The documentation states

pip install dask: Install only dask, which depends only on the standard library. This is appropriate if you only want the task schedulers.

With dask==0.12.0 installed an import fails, because toolz is not required as a dependency.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input> in <module>()
      1 import pandas as pd
----> 2 import dask

lib/python3.5/site-packages/dask/__init__.py in <module>()
      3 from .core import istask
      4 from .context import set_options
----> 5 from .async import get_sync as get
      6 try:
      7     from .delayed import do, delayed, value

lib/python3.5/site-packages/dask/async.py in <module>()
    118 import traceback
    119 
--> 120 from toolz import identity
    121 
    122 from .compatibility import Queue

ImportError: No module named 'toolz'

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 6
  • Comments: 19 (12 by maintainers)

Commits related to this issue

Most upvoted comments

The error message also appears in this variant: “No module named ‘tlz’”.

>>> import dask.array as da
Traceback (most recent call last):
  File "/home/me/.local/lib/python3.7/site-packages/dask/array/__init__.py", line 2, in <module>
    from .blockwise import blockwise, atop
  File "/home/me/.local/lib/python3.7/site-packages/dask/array/blockwise.py", line 4, in <module>
    import tlz as toolz
ModuleNotFoundError: No module named 'tlz'

Running pip install dask[complete] [--user], among other options, corrects this.

@mrocklin I’d be happy to do a PR.

It’s well-documented on dask.pydata.org, but would it also be okay if I added a small note to the README, mirroring what’s in the “Install Dask” section of the documentation?

##Installation

To install Dask with pip there are a few options, depending on which
dependencies you would like to keep up to date:

* pip install dask[complete]: Install everything
* pip install dask[array]: Install dask and numpy
* pip install dask[bag]: Install dask and cloudpickle
* pip install dask[dataframe]: Install dask, numpy, and pandas
* pip install dask: Install only dask, which depends only on the standard
  library. This is appropriate if you only want the task schedulers.

We do this so that users of the lightweight core dask scheduler aren’t required
to download the more exotic dependencies of the collections (numpy, pandas,
etc.).

For more information, see the [installation
documentation](http://dask.pydata.org/en/latest/install.html)

I too was surprised when pip install dask followed by import dask.dataframe as dd didn’t just work (I get the error from this issue, plus cloudpickle is required).

pip install dask[complete]

On Sun, Apr 28, 2019 at 1:01 PM StephenBoesch notifications@github.com wrote:

I ran the command for “dask[delayed]” and still get

ImportError: No module named 'cloudpickle ’

Is there a way to avoid whack-a-mole here?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/dask/dask/issues/1849#issuecomment-487401835, or mute the thread https://github.com/notifications/unsubscribe-auth/AACKZTDMWNMS3IOO7ANYDHDPSXQ6NANCNFSM4CZY2TXA .

@darrenleeweber the extra toolz dependency for dask.delayed can be installed via:

pip install "dask[delayed]"

However, this is not clear from the current installation docs. I’ve opened up #4660 to help clarify.

Starting at the next release(2021.03.1), pip install dask will include toolz.

@ernstki the accepted answer is still accurate. In fact, the error message raised in Dask itself today looks very similar to the stackoverflow answer. For example, if (in a fresh environment) one does pip install dask and then tries to import dask.dataframe you’ll get:

ImportError: Dask dataframe requirements are not installed.

Please either conda or pip install as follows:

  conda install dask                     # either conda install
  python -m pip install "dask[dataframe]" --upgrade  # or python -m pip install