elfi-dev / elfi

ELFI - Engine for Likelihood-Free Inference
http://elfi.readthedocs.io
BSD 3-Clause "New" or "Revised" License
267 stars 60 forks source link

BOLFI fails if numpy version is >= 1.20 #447

Closed givasile closed 1 year ago

givasile commented 1 year ago

Summary:

BOLFI fails if numpy version is >= 1.20

Description:

By default, ELFI requires numpy>=1.12.1, <1.24. For versions >= 1.20 the type aliases, e.g. np.float, np.int etc, are deprecated BOLFI initialization (and possibly other methods?) get an error.

Reproducible Steps:

import numpy as np
import elfi

seed = 1
np.random.seed(seed)
model = ma2.get_model(seed_obs=seed)

bolfi = elfi.BOLFI(model, target_name = "d",
                   batch_size=1,
                   initial_evidence=20,
                   update_interval=10,
                   bounds={'t1':(-2, 2), 't2':(-1.25, 1.25)},
                   acq_noise_var=0.1,
                   seed=seed)

Current Output:

AttributeError: module 'numpy' has no attribute 'int'

ELFI Version: 0.8.4

Python Version: 3.9

Operating System: Ubuntu

uremes commented 1 year ago

hi thanks for the report!

i think the deprecation did not expire until numpy 1.24, but the numpy version is not constrained to <1.24 in the current pypi release for example. in other words i could see this error when i pip installed elfi, but pip install --force-reinstall numpy==1.23.5 removed the error for me. that said, we will update the numpy data types as soon as possible and release a new version.