AttributeError: module 'numpy' has no attribute 'float'
Code uses np.float/np.int/np.bool/np.object, which were removed in NumPy 1.24.
Seen on:
Python
Meaning
These were aliases for Python built-ins, deprecated in 1.20 and removed in 1.24. Old code and old library versions break after upgrading NumPy.
Common causes
- Your code uses np.float / np.int
- A dependency not updated for NumPy 1.24+
- NumPy 2.0 removed more aliases (np.NaN, np.Inf)
⚡ Quick fix
- Use built-ins (float, int, bool) or explicit types (np.float64, np.int64)
- Upgrade the library that uses the alias
- Pin numpy<1.24 temporarily
Detailed fix by platform
Python
x = np.zeros(10, dtype=np.float64)
How to diagnose
- Origin — Your code or a library?
- Version — numpy.__version__
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026