Hoping for some insight/help with solving the runtime error which occurs when trying to run the NUTS sampler (on very simple regression model example) with more than one chain (see below)? Running current pyMC3 v. 3.9.3.
Any insight would be much appreciated.
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
BrokenPipeError: [Errno 32] Broken pipe
I’m guessing you’re on Windows? In which case I think you have to set
pm.sample to disable multiprocessing
Magic, that solved the problem, thanks! Happily runs multiple chains in series now!
I am running on Macbook Pro MacOS Mojave 10.14.6 with a 3.1 GHz Intel Core i7 processor, which I believe has 2 cores? Is there a way to set things up so pymc3 can access both cores? Sorry if this is in FAQs.
Try putting your code in a
__main__ block, i.e.,
if __name__ == "__main__":
It’s not totally clear what’s going on—some change to the default multiprocessing behavior in Python 3.8—but I ran into this a few weeks ago. See this Github issue for more, possibly.
Ah indeed, if you’re on MacOS you should be able to use multiprocessing. Depending on your how you’re using
pm.sample, @tushar_chandra’s solution will work