Cannot pickle '_thread.lock' object type error when running pm.sample

Hi, I am trying to use a black box likelihood function, essentially following the example here (initially without gradients): Using a “black box” likelihood function (numpy) — PyMC example gallery

I have swapped the linear regression model with my own, but I am encountering the error in the images at the pm.sample stage. Any ideas how to solve this? I am new to pymc / pickle files / parallel threading.

Maybe your custom function can’t be pickled. Can you start by just confirming it runs fine with cores=1?

What version and OS are you running with?

Hi Ricardo, hmm it seems the sampling is not making any progress with cores=1. I’m running v5.3.0 on Windows.

Seems that it’s just very slow, the Slice sampler may require many evaluations to find the right proposal width the first time. Try to reduce the amount of variables/data just to get things running.