Python NumPy Not Found: How to Fix No Module Named NumPy

Your script dies on line one with ModuleNotFoundError: No module named 'numpy'. NumPy usually isn’t missing from your computer. It’s missing from the Python that’s running your code.

Quick answer: a Python NumPy not found error means the interpreter running your script has no NumPy package. Install it into that same interpreter with python -m pip, then rerun the script with the same python command:

python -m pip install numpy

In this tutorial, we’ll fix Python NumPy not found errors the way our team does it: reproduce the error, find which Python can’t see NumPy, install it there and confirm the import. We ran every step on Windows with Python 3.14.8 and NumPy 2.5.4.

What You Need Before You Start Fixing NumPy Not Found

  • A terminal: Command Prompt or PowerShell on Windows, Terminal on macOS or Linux.
  • Python 3.12 or newer. NumPy 2.5.4 declares Requires-Python >=3.12.
  • An internet connection, so pip can download NumPy.

Our running sample is sales.py, a four-week sales total. If you’re unsure how to start a script from the terminal, see how to run a Python script.

Step 1: Reproduce the NumPy not found error

We always run the failing script first, so we know exactly what we’re fixing. Here’s sales.py in a fresh virtual environment (a private Python folder with its own packages) that doesn’t have NumPy yet:

import numpy as np

sales = np.array([1249.99, 879.50, 1530.25, 990.00])   # weekly sales, USD
print(f"Total: ${sales.sum():,.2f}")
print(f"Average week: ${sales.mean():,.2f}")

Output:

Traceback (most recent call last):
  File "C:\pyguides\sales.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
Command Prompt traceback for a Python NumPy not found error: ModuleNotFoundError: No module named 'numpy'
The script stops on import numpy as np, so no total is printed.

The last line names the missing module, and it fails on the import itself. The code is fine; the environment isn’t.

Step 2: Check which Python can’t find NumPy

Most machines have more than one Python, and each has its own packages. We print the running interpreter, then ask its pip about NumPy. More on juggling installs is in installing multiple Python versions.

import sys

print("Python", sys.version.split()[0])
print("Running from:", sys.executable)

Output:

Python 3.14.8
Running from: C:\pyguides\npdemo\Scripts\python.exe
WARNING: Package(s) not found: numpy
Name: numpy
Version: 2.5.3
Summary: Fundamental package for array computing in Python
Home-page: https://numpy.org
Author: Travis E. Oliphant et al.
Author-email: 
License: 
Location: C:\pyguides\venv\Lib\site-packages
Requires: 
Required-by: contourpy, formulaic, matplotlib, opencv-python, pandas, patsy, scikit-learn, scipy, statsmodels
Command Prompt showing sys.executable for the running Python, pip show numpy not found, and NumPy installed in a different Python
The running Python says NumPy isn’t installed, while a second Python on the same machine already has it.

That’s the classic trap: NumPy was installed, but into C:\pyguides\venv, and the script runs from C:\pyguides\npdemo. A plain pip command can point at either one.

Step 3: Install NumPy with python -m pip

python -m pip runs pip through the exact interpreter you call, so the package lands where your script looks. We install, then rerun the same file:

python -m pip install numpy
python sales.py

Output:

Collecting numpy
  Using cached numpy-2.5.4-cp314-cp314-win_amd64.whl.metadata (6.6 kB)
Using cached numpy-2.5.4-cp314-cp314-win_amd64.whl (12.7 MB)
Installing collected packages: numpy
Successfully installed numpy-2.5.4
Total: $4,649.74
Average week: $1,162.43
Command Prompt running python -m pip install numpy, then the sales script printing the total and average
pip reports Successfully installed numpy, and sales.py now prints both numbers.

The sample now prints Total: $4,649.74 and Average week: $1,162.43. Need an older release for a legacy project? See installing a specific version with pip.

Note: on Windows, py -m pip install numpy uses the Python launcher’s default Python, and on macOS or Linux use python3 -m pip. Run the script with that same command.

Step 4: Confirm NumPy imports in the right Python

We finish with a two-line check that prints the versions and where NumPy was loaded from:

import sys
import numpy

print("Python", sys.version.split()[0], "| NumPy", numpy.__version__)
print("Loaded from:", numpy.__file__)

Output:

Python 3.14.8 | NumPy 2.5.4
Loaded from: C:\pyguides\npdemo\Lib\site-packages\numpy\__init__.py

The path points inside npdemo, so it’s the copy we just installed. Our guide to checking your Python version shows more ways to read the interpreter version.

How do you fix NumPy not found in VS Code, Jupyter or Anaconda?

It’s the same cause: the editor or kernel runs a different Python than your terminal. In VS Code, run Python: Select Interpreter from the Command Palette and pick the environment that has NumPy.

In a Jupyter notebook, run %pip install numpy in a cell, since it installs into the kernel’s Python, then restart the kernel. In Anaconda, use conda install numpy in the active environment. ModuleNotFoundError after pip install covers the editor cases in more depth.

NumPy Not Found Cheat Sheet

Here’s the quick map we use for this error:

What you seeLikely causeFix
No module named 'numpy'NumPy not in the running Pythonpython -m pip install numpy
Works in terminal, fails in VS CodeEditor uses another interpreterPython: Select Interpreter
Fails in Jupyter onlyKernel uses another Python%pip install numpy, restart kernel
No module named 'Numpy'Wrong case in the importimport numpy
has no attribute 'array'Your own file named numpy.pyRename the file

Common Mistakes to Avoid with NumPy Imports

Two mistakes look like a missing install but aren’t. First, module names are case-sensitive, even on Windows:

import Numpy as np

Output:

Traceback (most recent call last):
  File "C:\pyguides\report.py", line 1, in <module>
    import Numpy as np
ModuleNotFoundError: No module named 'Numpy'

Second, a file of your own named numpy.py sits first on the import path, so Python imports it instead of the real library:

import numpy as np

print(np.array([19.99, 5.49]))

Output:

Traceback (most recent call last):
  File "C:\pyguides\npshadow\prices.py", line 3, in <module>
    print(np.array([19.99, 5.49]))
          ^^^^^^^^
AttributeError: module 'numpy' has no attribute 'array'
Command Prompt AttributeError because a local numpy.py file shadows the NumPy library
Python loads the local numpy.py, so the error says array is missing instead of NumPy.

Rename that file and delete any __pycache__ folder next to it. A different message, numpy.core.multiarray failed to import, is a version clash instead; see fixing numpy.core.multiarray failed to import.

Next Steps after NumPy imports

With NumPy working, I’d start with arrays you can see and print. Our tutorial on making a matrix in Python is a good next stop.

Here are a few more NumPy and pip guides we point teammates to:

Frequently asked questions

Why does Python say no module named numpy after I installed it?

pip installed NumPy into a different Python than the one running your script. Run python -m pip install numpy with the same python you use to run the code.

How do I check if NumPy is installed?

Run python -m pip show numpy. It prints the version and location, or a Package(s) not found warning when it’s missing.

Is pip install numpy the same as python -m pip install numpy?

Only when pip belongs to the same Python. python -m pip always targets the interpreter you named, so it’s the safer habit.

Do I need to reinstall NumPy in every virtual environment?

Yes. Each virtual environment has its own packages, so activate it and run python -m pip install numpy inside it.

Why is NumPy not found in Jupyter Notebook?

The kernel runs its own Python. Run %pip install numpy in a notebook cell, then restart the kernel.

Where are the official install instructions?

See Installing Packages in the Python Packaging User Guide.