2
votes

I'm a rookie using Dask and I installed the new version 2.12.0 on my MacBook MacOS High Sierra 10.13.6. When I try to start the distributed mode with the code below:

from dask.distributed import Client
c = Client()

I got the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-67101dbde0b6> in <module>()
      1 from dask.distributed import Client
----> 2 c = Client()

~/anaconda3/lib/python3.6/site-packages/distributed/client.py in __init__(self, address, loop, timeout, set_as_default, scheduler_file, security, asynchronous, name, heartbeat_interval, **kwargs)
    554         if set_as_default:
    555             self._previous_get = _globals.get('get')
--> 556             dask.set_options(get=self.get)
    557             self._previous_shuffle = _globals.get('shuffle')
    558             dask.set_options(shuffle='tasks')

AttributeError: module 'dask' has no attribute 'set_options'

Also, if I instantiate the c = Client(set_as_default=False) the cluster seems to successfully raise because I get the connection information for the dashboard (see this image). But as I navigate through the dashboard the following error is triggered.

According to the documentation lifting a single machine cluster seems to be trivial but I don't know what could be wrong. I would be very grateful if someone could guide me on how to solve this incident ;)

1
Just to check, what is the name of your python module containing c = Client()? - dspencer
Hi @dspencer, I imported that module through: from dask.distributed import Client - Alonso Carvajal Moreno
I mean, what is the name of the python script you are running? I just want to make sure that it is not dask.py - dspencer
Yes @dspencer, the module name was dask.py. I renamed the module by another but the error persists: AttributeError: module 'dask' has no attribute 'set_options'. - Alonso Carvajal Moreno
How did you install dask? You should use pip install dask[complete] to install everything - dspencer

1 Answers

2
votes

Your source file is named dask.py, which introduces a naming conflict between your module, dask.py, and the dask package, with your module taking precedence in later import statements. Therefore, when distributed/client.py attempts to call dask.set_options, this fails with AttributeError as your module does not provide this function.

After running this dask.py module, python caches the compiled python code. Therefore, even when you renamed your module to something else, the import name conflict still exists. To resolve this, you should delete the __pycache__ directory after which you should find that your module executes successfully.