Numpy Depedency Issue Using Nutpie/Numba

Hi All,

Sorry if this is already a known issue, but I was unable to find a solution.

I am trying to use Nutpie for sampling, but ran into the following error:

Numba needs NumPy 1.24 or less

I was using Numpy version 1.26.4 at that point, and then decided I would switch to Numpy 1.24.4. The installation worked fine, I was even able to run sampling via Nutpie using:

compiled_model = nutpie.compile_pymc_model(model)
trace = nutpie.sample(compiled_model)

But when I went to run normal sampling via:

with model:
  idata = pm.sample(1000, tune=1000, cores=4, chains=4, random_seed=rng)

I got the following error:
'numpy.random._generator.Generator' object has no attribute 'spawn'

So it looks like PyMC requires numpy>=1.25 to perform normal sampling, but Numba requires numpy<=1.24 for compilation.

Has anyone ran into this as well? For reference, I am using:

  • Dataricks 15.4 ML runtime
  • PyMC == 5.19.0
  • nutpie == 0.13.2

Any help is very much appreciated!

CC @lucianopaz we may need to revert the numpy dependency bump

1 Like

What version of numba are you using? Their GitHub source code shows a minimum numpy version but not an upper bound version.

3 Likes

This was the crux, looks like I was running an older version of Numba. Was not even able to import it without the warning. I have upgraded to Numba version 0.60.0 and everything is working as expected now. Thank you!!

2 Likes