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

AttributeError: np.sctypes was removed in NumPy 2.0 release #859

Open
qja1998 opened this issue Oct 17, 2024 · 1 comment
Open

AttributeError: np.sctypes was removed in NumPy 2.0 release #859

qja1998 opened this issue Oct 17, 2024 · 1 comment

Comments

@qja1998
Copy link

qja1998 commented Oct 17, 2024

In the latest release of NumPy (2.0), the np.sctypes attribute has been removed. As a result, the following code in the imgaug library causes an AttributeError:

NP_FLOAT_TYPES = set(np.sctypes["float"])
NP_INT_TYPES = set(np.sctypes["int"])
NP_UINT_TYPES = set(np.sctypes["uint"])

This issue can be found in the following link:
Problematic code

I think modifying the code to directly reference NumPy's dtypes instead of using np.sctypes. For example:

NP_FLOAT_TYPES = {np.float16, np.float32, np.float64}
NP_INT_TYPES = {np.int8, np.int16, np.int32, np.int64}
NP_UINT_TYPES = {np.uint8, np.uint16, np.uint32, np.uint64}

Feel free to fill in the Python version and operating system, then copy and paste this into a new issue on the GitHub repository. Let me know if you need any more help!

@tindo2003
Copy link

This works for me. Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants