Multiprocess sampling without using Pickle

Is it possible to carry out multiprocess sampling without using Pickle? My PYmC3 model requires the use of an FEM solver tool (esys-escript) to calculate the output and whenever i set njobs>1 or cores>1 i get the following error:

Multiprocess sampling (2 chains in 2 jobs)
Slice: [pr_vec]
Slice: [sigma_log__]
Traceback (most recent call last):
File “”, line 107, in
trace = pm.sample(step=pm.Slice(), start=start, njobs=2)
File “/home/nick/.local/lib/python2.7/site-packages/pymc3/”, line 442, in sample
trace = _mp_sample(**sample_args)
File “/home/nick/.local/lib/python2.7/site-packages/pymc3/”, line 982, in _mp_sample
traces = Parallel(n_jobs=cores, mmap_mode=None)(jobs)
File “/home/nick/.local/lib/python2.7/site-packages/joblib/”, line 789, in call
File “/home/nick/.local/lib/python2.7/site-packages/joblib/”, line 699, in retrieve
File “/usr/lib/python2.7/multiprocessing/”, line 572, in get
raise self._value
RuntimeError: Pickling of “esys.escriptcore.escriptcpp.Data” instances is not enabled (

I’ve read that dill is more robust than pickle but i’m not sure how to implement it. Can dill be used instead of Pickle? Alternatively, is there some other way to prevent PYmC3 from using Pickle but still carry out multiprocess sampling?


You are just in time to test the newly merge none pickle require parallel process:

Please update to master and try running your script again.

1 Like

Awesome! That works great now. Thanks.

1 Like