np.float deprecation error
Numpy versions >1.2.0 deprecated some data types used by the Python code in the Fermitools, so recent installs of the tools have resulted errors when running pyLikelihood, e.g.,
AttributeError: module 'numpy' has no attribute 'float'.
np.floatwas a deprecated alias for the builtinfloat. To avoid this error in existing code, usefloatby itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, usenp.float64here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
The FSSC needs to go through the Fermitool python code, fix any places this occurs, and check for any other deprecation in recent Numpy releases that might affect the tools.
Until we get it fixed, users can get a working version by pinning the Numpy version to the last Numpy that allowed deprecated types, e.g.,
conda install -n fermitools -c conda-forge -c fermi numpy=1.20
Do we have any specific examples? Doing a quick grep on np.float only returns 5 instances in the entire code base, one in BayesianBlocks and four in pyBurstAnalysisGUI. If that's really all there is, this will be quick.
If you install a fresh version of the tools and try to run the Python thread, you should get the error when running UnbinnedAnalysis. Make sure that we're not using any of the other deprecated data types in 1.20.0. It looks like Numpy is up to 1.25.0, so check if there was anything else deprecated in later versions that would affect us, too.
Just to be thorough: np.int is also going away.
That was my plan. I was going to work through all of deprecation notes and see what I find.
I am working with UnbinnedAnalysis and the error still persists. I am on fermitools 2.2.0. Is there a new release of the software yet?
If working in python, please try the following before importing the UnbinnedAnalysis
import numpy as np np.float=float