4

It is my simple code.Trying to run my 1st program.

from dask.distributed import Client
client = Client('192.168.1.102:8786')


def inc(x):
    return x + 1

x = client.submit(inc, 10)
print(x.result())

when trying to run this code by using this command:

$python3 filename.py

I am geing this error:

/usr/local/lib/python3.4/dist-packages/distributed/protocol/pickle.py
- INFO - Failed to serialize <function inc at 0x7f678ad05840> Traceback (most recent call last):   File
"/usr/local/lib/python3.4/dist-packages/distributed/protocol/pickle.py",
line 33, in dumps
    return cloudpickle.dumps(x, protocol=pickle.HIGHEST_PROTOCOL) AttributeError: 'module' object has no attribute 'dumps'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):   File
 "/usr/local/lib/python3.4/dist-packages/distributed/protocol/pickle.py",
 line 43, in dumps
    return cloudpickle.dumps(x, protocol=pickle.HIGHEST_PROTOCOL) AttributeError: 'module' object has no attribute 'dumps' Traceback
 (most recent call last):   File
 "/usr/local/lib/python3.4/dist-packages/distributed/protocol/pickle.py",
 line 33, in dumps
     return cloudpickle.dumps(x, protocol=pickle.HIGHEST_PROTOCOL) AttributeError: 'module' object has no attribute 'dumps'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):   File "dis.py", line 8, in
 <module>
    x = client.submit(inc, 10)   File "/usr/local/lib/python3.4/dist-packages/distributed/client.py", line
 643, in submit
     loose_restrictions, priority={skey: 0})   File "/usr/local/lib/python3.4/dist-packages/distributed/client.py", line
 1235, in _graph_to_futures
     'tasks': valmap(dumps_task, dsk3),   File "/usr/local/lib/python3.4/dist-packages/toolz/dicttoolz.py", line 84,
 in valmap
     rv.update(zip(iterkeys(d), map(func, itervalues(d))))   File "/usr/local/lib/python3.4/dist-packages/distributed/worker.py", line
 812, in dumps_task
     return {'function': dumps_function(task[0]),   File "/usr/local/lib/python3.4/dist-packages/distributed/worker.py", line
 779, in dumps_function
     b = dumps(func)   File "/usr/local/lib/python3.4/dist-packages/distributed/protocol/pickle.py",
 line 43, in dumps
     return cloudpickle.dumps(x, protocol=pickle.HIGHEST_PROTOCOL) AttributeError: 'module' object has no attribute 'dumps'
Mairbek Khadikov
  • 7,939
  • 3
  • 35
  • 51
Sudip Das
  • 1,178
  • 1
  • 9
  • 24

1 Answers1

4

Often pickling errors are signs that some element of your Dask.distributed network (worker, scheduler, or client) has a Python version mismatch. Perhaps your workers are running under Python 2 without you realizing it?

That error in particular says that the cloudpickle library doesn't have a dumps method, which is fairly odd. As far as I can recall cloudpickle has always had a dumps function. Do you perhaps have an odd cloudpickle library in your environment or a very old version?

If you're just trying things out, you can also launch a local cluster within your same process by omiting the address of the scheduler

from dask.distributed import Client

# client = Client('scheduler-address:8786')
client = Client()  # create local "cluster"
MRocklin
  • 55,641
  • 23
  • 163
  • 235
  • my code is running well in ipython bt not working in python3 – Sudip Das Dec 04 '16 at 22:48
  • i also removed the ip from the Client() ..and getting the same error ... really i don't know what is actually going on ...bt this code is running fine in ipython – Sudip Das Dec 04 '16 at 23:10
  • 1
    Perhaps you're having trouble running multiple Python environments with your system Python. You could try using Anaconda instead? These sorts of issues tend to go away. – MRocklin Dec 05 '16 at 12:55
  • try using vitualenv and isolate ur python workspace! see http://docs.python-guide.org/en/latest/dev/virtualenvs/ – earthdan Dec 05 '16 at 17:59
  • @MRocklin okk i fixed it after reinstalling the python3.4 ...i think there was some problem of installation thanks for helping me :) – Sudip Das Dec 07 '16 at 19:01