Skip to content

multiprocessing and offline mode results in pickle error. #786

Closed

Description

Simply setting plotly.offline.init_notebook_mode(connected=True) results in a cPickle.PicklingError.

Traceback (most recent call last):
  File "meh.py", line 13, in 
    results = pool.map(do_something, ["foo", "bar"])
  File "/usr/local/lib/python2.7/multiprocessing/pool.py", line 251, in map
    return self.map_async(func, iterable, chunksize).get()
  File "/usr/local/lib/python2.7/multiprocessing/pool.py", line 567, in get
    raise self._value
cPickle.PicklingError: Can't pickle : attribute lookup __builtin__.function failed

Example code:

import multiprocessing as mp
import plotly

plotly.offline.init_notebook_mode(connected=True)

def do_something(s):
  return s

if __name__ == "__main__":
   pool_size = mp.cpu_count()
   pool = mp.Pool(processes=pool_size)
   results = pool.map(do_something, ["foo", "bar"])
   pool.close()
   pool.join()
   print results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions