FWIW, having the exact same issue on MacOS.
Defined my logistic regression model and it works with cores = 1, but as soon as I try to increase the cores it just never gets started. Here’s where it hangs:
Auto-assigning NUTS sampler...
Initializing NUTS using adapt_diag...
Multiprocess sampling (2 chains in 4 jobs)
NUTS: [X1, X2, X3, X4, Intercept]
Sampling 2 chains, 0 divergences: 0%| | 0/4000 [00:00<?, ?draws/s]
And this is the stack trace when I stop it after > 30 mins:
---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
~/opt/anaconda3/lib/python3.7/site-packages/pymc3/sampling.py in _mp_sample(draws, tune, step, chains, cores, chain, random_seed, start, progressbar, trace, model, **kwargs)
1058 with sampler:
-> 1059 for draw in sampler:
1060 trace = traces[draw.chain - chain]
~/opt/anaconda3/lib/python3.7/site-packages/pymc3/parallel_sampling.py in __iter__(self)
393 while self._active:
--> 394 draw = ProcessAdapter.recv_draw(self._active)
395 proc, is_last, draw, tuning, stats, warns = draw
~/opt/anaconda3/lib/python3.7/site-packages/pymc3/parallel_sampling.py in recv_draw(processes, timeout)
283 pipes = [proc._msg_pipe for proc in processes]
--> 284 ready = multiprocessing.connection.wait(pipes)
285 if not ready:
~/opt/anaconda3/lib/python3.7/multiprocessing/connection.py in wait(object_list, timeout)
919 while True:
--> 920 ready = selector.select(timeout)
921 if ready:
~/opt/anaconda3/lib/python3.7/selectors.py in select(self, timeout)
414 try:
--> 415 fd_event_list = self._selector.poll(timeout)
416 except InterruptedError:
KeyboardInterrupt:
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-126-91d098b82ba5> in <module>
1 with logistic_model:
----> 2 pred_trace = pm.sample(draws=1000, tune=1000, chains=2, cores=4, init='adapt_diag')
~/opt/anaconda3/lib/python3.7/site-packages/pymc3/sampling.py in sample(draws, step, init, n_init, start, trace, chain_idx, chains, cores, tune, progressbar, model, random_seed, discard_tuned_samples, compute_convergence_checks, **kwargs)
467 _print_step_hierarchy(step)
468 try:
--> 469 trace = _mp_sample(**sample_args)
470 except pickle.PickleError:
471 _log.warning("Could not pickle model, sampling singlethreaded.")
~/opt/anaconda3/lib/python3.7/site-packages/pymc3/sampling.py in _mp_sample(draws, tune, step, chains, cores, chain, random_seed, start, progressbar, trace, model, **kwargs)
1078 return MultiTrace(traces)
1079 except KeyboardInterrupt:
-> 1080 traces, length = _choose_chains(traces, tune)
1081 return MultiTrace(traces)[:length]
1082 finally:
~/opt/anaconda3/lib/python3.7/site-packages/pymc3/sampling.py in _choose_chains(traces, tune)
1094 lengths = [max(0, len(trace) - tune) for trace in traces]
1095 if not sum(lengths):
-> 1096 raise ValueError("Not enough samples to build a trace.")
1097
1098 idxs = np.argsort(lengths)[::-1]
ValueError: Not enough samples to build a trace.