Sherry
Sherry

Reputation: 471

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

Using Pycharm Community 2018.1.4
Python 3.6
Dask 2.8.1

Trying to implement dask delayed on some of my methods and getting an error

AttributeError: module 'dask' has no attribute 'delayed'.

This is obviously not true so I am wondering what I am doing wrong. My implementation structure is as follows:

import dask
def main()
  for i, fn in enumarate(filenames):
     data = {}
     for x in range(0,2):
         data.update(dask.delayed(load_data)(fn, x))
         succes_flag = dask.delayed(execute_analytic)(data)

         if success_flag == 1:
            print("success")
         else:
            print("fail")

def load_data(filename,selector):

def execute_analytic(data)

if __name__ == '__main__':
    dask.compute(main())

Essentialy, I have a bunch of data files, which are independant of each other and so I want to run them in parallel instead of sequentially through a for loop, which i was doing if you take the dask.delayed out.
Am i fundamentally missing anything in the above implementation of dask delayed?

Upvotes: 3

Views: 10645

Answers (3)

casper.dcl
casper.dcl

Reputation: 14769

pip install "dask[delayed]" is the minimal requirement to directly answer the OP (the other answers may install unnecessary dependencies)

Upvotes: 2

Kowsalya R
Kowsalya R

Reputation: 310

I refer the following URL https://github.com/dask/dask/issues/1849

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.

Upvotes: 6

MRocklin
MRocklin

Reputation: 57251

You probably only installed the core library, rather than the full library with normal dependencies.

conda install dask
or
pip install dask[complete]

See https://docs.dask.org/en/latest/install.html for more information

Upvotes: 3

Related Questions