AttributeError: module 'numpy' has no attribute 'float'
Code uses np.float/np.int/np.bool/np.object, which were removed in NumPy 1.24.
module 'numpy' has no attribute 'float'module 'numpy' has no attribute 'int'has no attribute 'NaN' 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 not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Python
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 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.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 13 Oct 2026