AttributeError: np.sctypes was removed in NumPy 2.0 release
Author: qja1998Created Oct 17, 2024Updated Sep 22, 2025
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!
Source: aleju/imgaug