Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

np.float deprecation error #143

Open
donhorner opened this issue May 10, 2023 · 6 comments
Open

np.float deprecation error #143

donhorner opened this issue May 10, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@donhorner
Copy link

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.float was a deprecated alias for the builtin float. To avoid this error in existing code, use float by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64 here.
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

@donhorner donhorner added the bug Something isn't working label May 10, 2023
@donhorner donhorner assigned jasercion and dagorym and unassigned jasercion May 10, 2023
@dagorym
Copy link
Member

dagorym commented May 15, 2023

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.

@donhorner
Copy link
Author

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.

@kerrm
Copy link

kerrm commented May 15, 2023

Just to be thorough: np.int is also going away.

@dagorym
Copy link
Member

dagorym commented May 15, 2023

That was my plan. I was going to work through all of deprecation notes and see what I find.

@amritphy
Copy link

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?

@nmirabal
Copy link

If working in python, please try the following before importing the UnbinnedAnalysis

import numpy as np
np.float=float

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants