python import ai_generated true

ModuleNotFoundError: No module named 'numpy'

ID: python/modulenotfounderror-no-module-named

Also available as: JSON · Markdown
97%Fix Rate
98%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
310 active

Root Cause

Python cannot find the specified module — not installed, wrong environment, or wrong Python version.

generic

Workarounds

  1. 97% success Install in the correct virtual environment: pip install numpy (with venv activated)
    Verify with: which python && pip list | grep numpy
  2. 93% success Ensure you're using the right Python: python -m pip install numpy
    python -m pip ensures pip matches the Python interpreter

    Sources: https://docs.python.org/3/installing/index.html

Dead Ends

Common approaches that don't work:

  1. Installing globally with sudo pip install 75% fail

    Installs in system Python which may be different from your project's Python

  2. Adding the module to sys.path manually 70% fail

    Fragile; path changes break the import

Error Chain

Frequently confused with: