numpy alias removed 🐍 Python

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

  1. Use built-ins (float, int, bool) or explicit types (np.float64, np.int64)
  2. Upgrade the library that uses the alias
  3. Pin numpy<1.24 temporarily

Detailed fix by platform

Python

  1. x = np.zeros(10, dtype=np.float64)

How to diagnose

  1. Origin — Your code or a library?
  2. 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.