Closed
Description
Describe the issue:
PyMC now relies on the spawn()
method from numpy.random._generator.Generator
. But this is a relatively recent addition to numpy (added in v1.25). So we need to set a lower limit on the numpy dependency.
Reproduceable code example:
import pymc as pm
with pm.Model() as model:
a = pm.Normal("a")
obs = pm.Normal("obs", a, 1, observed=[1,2])
idata = pm.sample()
Error message:
```shell
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Input In [7], in ()
7 a = pm.Normal("a")
8 obs = pm.Normal("obs", a, 1, observed=[1,2])
----> 9 idata = pm.sample()
11 print(az.summary(idata))
File ~/mambaforge/envs/pymc/lib/python3.10/site-packages/pymc/sampling/mcmc.py:733, in sample(draws, tune, chains, cores, random
_seed, progressbar, progressbar_theme, step, var_names, nuts_sampler, initvals, init, jitter_max_retries, n_init, trace, discard
_tuned_samples, compute_convergence_checks, keep_warning_stat, return_inferencedata, idata_kwargs, nuts_sampler_kwargs, callback
, mp_ctx, blas_cores, model, compile_kwargs, **kwargs)
731 if random_seed == -1:
732 random_seed = None
--> 733 rngs = get_random_generator(random_seed).spawn(chains)
734 random_seed_list = [rng.integers(2**30) for rng in rngs]
736 if not discard_tuned_samples and not return_inferencedata:
AttributeError: 'numpy.random._generator.Generator' object has no attribute 'spawn'
```
PyMC version information:
# packages in environment at /home/xian/mambaforge/envs/pymc:
#
# Name Version Build Channel
numpy 1.24.2 py310h8deb116_0 conda-forge
pymc 5.19.0 hd8ed1ab_0 conda-forge
pymc-base 5.19.0 pyhd8ed1ab_0 conda-forge
pytensor 2.26.4 py310ha549d7f_0 conda-forge
pytensor-base 2.26.4 py310h89e8f5a_0 conda-forge