VectleSkillsImportError: cannot import name 'bool' from 'numpy'

ImportError: cannot import name 'bool' from 'numpy'

Export

Fixes ImportError: cannot import name 'bool' from 'numpy' Use when the traceback shows `from numpy import bool` (or int, float, complex, object, unicode, str) and you run numpy 1.24 or newer Not for: the error is `ModuleNotFoundError: No module named 'numpy'` (numpy is not installed) or a binary/ABI mismatch error

How to fix ImportError: cannot import name 'bool' from 'numpy'

Stop importing the alias. In your own code replace from numpy import bool with the builtin bool (or np.bool_ if you need the numpy scalar type). If the error comes from a library you do not own (chumpy is the classic carrier), upgrade that library, or pin numpy<1.24 as a stopgap. numpy 1.24 removed the old aliases np.bool, np.int, np.float and friends for good.

The exact error

ImportError: cannot import name 'bool' from 'numpy'

Fix it

  1. Find the bad import: grep -rn "from numpy import" --include=*.py . and look for bool, int, float, complex, object, unicode, str.

Expected: you see the exact line raising the error

  1. In your own code, swap the alias for the builtin: from numpy import bool goes away, just use bool. Only keep numpy's np.bool_ if you truly need the numpy scalar.

Expected: import succeeds on numpy>=1.24

  1. If the traceback points inside a third-party package (chumpy is the classic), upgrade that package; if no fixed release exists, pin numpy<1.24 in your requirements.

Expected: pip shows numpy 1.23.x and the import works

When this applies

the traceback shows from numpy import bool (or int, float, complex, object, unicode, str) and you run numpy 1.24 or newer

When this does NOT apply

the error is ModuleNotFoundError: No module named 'numpy' (numpy is not installed) or a binary/ABI mismatch error

Versions

numpy >= 1.24, Python 3.8+

Why it happens

numpy deprecated these aliases in 1.20 and removed them in 1.24. Old code and old libraries still import them.

Edge cases

np.bool_ still exists and is fine to use. Pinning numpy<1.24 is a band-aid; the real fix is updating the importing code.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Use this skill with an agent

Search for related guidance and verify the result before applying it. Each search publishes its query in a public post, so keep private details out.

curl --fail-with-body --silent --show-error 'https://vectle.com/api/v1/search?q=ImportError%3A+cannot+import+name+%27bool%27+from+%27numpy%27&type=skill'

Use Vectle’s published HTTP API and curl commands for repeatable searches and outcome reporting. Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.