Can't get this CAR example to work

Hi all, I was just trying to get this example to work on my notebook : Conditional Autoregressive (CAR) model — PyMC3 3.11.5 documentation

I keep getting this error:
Auto-assigning NUTS sampler…
Initializing NUTS using advi…

Convergence achieved at 17100
Interrupted at 17,099 [8%]: Average Loss = 334.26
Multiprocess sampling (4 chains in 4 jobs)
NUTS: [mu_phi, theta, tau_c, tau_h, beta1, beta0]
WARNING (theano.link.c.cmodule): install mkl with conda install mkl-service: No module named ‘mkl’
WARNING (theano.link.c.cmodule): install mkl with conda install mkl-service: No module named ‘mkl’
WARNING (theano.link.c.cmodule): install mkl with conda install mkl-service: No module named ‘mkl’
WARNING (theano.link.c.cmodule): install mkl with conda install mkl-service: No module named ‘mkl’


RemoteTraceback Traceback (most recent call last)
RemoteTraceback:
“”"
Traceback (most recent call last):
File “/Users/nhatnguyen/miniforge3/envs/bmcp/lib/python3.9/site-packages/pymc3/parallel_sampling.py”, line 116, in _unpickle_step_method
self._step_method = pickle.loads(self._step_method)
AttributeError: Can’t get attribute ‘CAR2’ on <module ‘main’ (built-in)>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Users/nhatnguyen/miniforge3/envs/bmcp/lib/python3.9/site-packages/pymc3/parallel_sampling.py”, line 135, in run
self._unpickle_step_method()
File “/Users/nhatnguyen/miniforge3/envs/bmcp/lib/python3.9/site-packages/pymc3/parallel_sampling.py”, line 118, in _unpickle_step_method
raise ValueError(unpickle_error)
ValueError: The model could not be unpickled. This is required for sampling with more than one core and multiprocessing context spawn or forkserver.
“”"

The above exception was the direct cause of the following exception:

ValueError Traceback (most recent call last)
ValueError: The model could not be unpickled. This is required for sampling with more than one core and multiprocessing context spawn or forkserver.

The above exception was the direct cause of the following exception:

RuntimeError Traceback (most recent call last)
Input In [21], in <cell line: 1>()
29 # Proportion sptial variance
30 alpha = pm.Deterministic(“alpha”, sd_c / (sd_h + sd_c))
—> 32 infdata2 = pm.sample(
33 1000,
34 tune=500,
35 cores=4,
36 init=“advi”,
37 target_accept=0.9,
38 max_treedepth=15,
39 return_inferencedata=True,
40 )

File ~/miniforge3/envs/bmcp/lib/python3.9/site-packages/pymc3/sampling.py:559, in sample(draws, step, init, n_init, start, trace, chain_idx, chains, cores, tune, progressbar, model, random_seed, discard_tuned_samples, compute_convergence_checks, callback, jitter_max_retries, return_inferencedata, idata_kwargs, mp_ctx, pickle_backend, **kwargs)
557 _print_step_hierarchy(step)
558 try:
→ 559 trace = _mp_sample(**sample_args, **parallel_args)
560 except pickle.PickleError:
561 _log.warning(“Could not pickle model, sampling singlethreaded.”)

File ~/miniforge3/envs/bmcp/lib/python3.9/site-packages/pymc3/sampling.py:1477, in _mp_sample(draws, tune, step, chains, cores, chain, random_seed, start, progressbar, trace, model, callback, discard_tuned_samples, mp_ctx, pickle_backend, **kwargs)
1475 try:
1476 with sampler:
→ 1477 for draw in sampler:
1478 trace = traces[draw.chain - chain]
1479 if trace.supports_sampler_stats and draw.stats is not None:

File ~/miniforge3/envs/bmcp/lib/python3.9/site-packages/pymc3/parallel_sampling.py:479, in ParallelSampler.iter(self)
476 self._progress.update(self._total_draws)
478 while self._active:
→ 479 draw = ProcessAdapter.recv_draw(self._active)
480 proc, is_last, draw, tuning, stats, warns = draw
481 self._total_draws += 1

File ~/miniforge3/envs/bmcp/lib/python3.9/site-packages/pymc3/parallel_sampling.py:359, in ProcessAdapter.recv_draw(processes, timeout)
357 else:
358 error = RuntimeError(“Chain %s failed.” % proc.chain)
→ 359 raise error from old_error
360 elif msg[0] == “writing_done”:
361 proc._readable = True

RuntimeError: Chain 0 failed.

For reference, this is the environment i’m working with on an M1 Macbook pro:
Last updated: Thu Jul 28 2022

Python implementation: CPython
Python version : 3.9.6
IPython version : 8.4.0

pandas: 1.3.2
arviz : 0.11.2
scipy : 1.7.1
theano: 1.1.2
numpy : 1.19.5
pymc3 : 3.11.4

Thank you in advance!