In today’s recipe we’ll discuss how to fix the pretty ubiquitous modulenotfounderror: no module named ‘numpy’ error on MAC , Linux Ubuntu and Windows 10 operating systems.
You typically get the error when working on Jupyter Notebook / Lab or when using your favorite Python IDE such as PyCharm, Spyder or others.
The error can occur either when working on standard Python installations, virtual environments and when using Environment Manager such as Anaconda or Miniconda.
Numpy module not found error
The module not found error is thrown when Python can’t find the package in your computer and has to be fixed by loading it from the Python Package Index repository. Here’s how to fix:
- Save your work and close Jupyter / PyCharm / Eclipse / Spyder / VSCode or other development environments you might be using
- Open your Terminal / Command prompt and point to your environment directory.
- Type the following
pip install numpy
- Hit Enter.
- The Numpy package will be be collected and downloaded from the Python Package repository into your environment.
- Re-open Jupyter or your IDE and try to import Numpy using
import numpy as np
Anaconda environments
The Numpy package is installed when you use the default Anaconda distribution, which contains pretty much all data analysis and data sciences you might need.
If you decided to skip Anaconda, and instead use Miniconda and install your Python packages manually you should proceed as following:
- Open the Anaconda Command Prompt
- Activate your Conda Virtual Environment using the following command: conda activate <path_to_your_environment>
- Then install Numpy using this command: conda install numpy
- The Numpy package will be collected and downloaded into your environment.
- Close the Anaconda Command Prompt.
- Re-open Jupyter or your favorite Python IDE and import Numpy.
Kindly leave us a comment in case of follow up questions.
Troubleshooting
Why does ModuleNotFoundError appear even after installing NumPy?
This typically happens when your Python environment has multiple interpreters and NumPy was installed in a different one than the one running your script. In PyCharm, verify the project interpreter under Settings → Project → Python Interpreter. In Anaconda, confirm the active environment with conda list numpy in your terminal. If you installed NumPy globally but your IDE uses a virtual environment, the module won’t be visible. The same mismatch causes issues with other scientific libraries — for instance, users frequently encounter the Matplotlib ModuleNotFoundError under similar conditions. Always install packages into the exact environment your project uses by running pip install numpy or conda install numpy with the correct environment activated.
How do I fix the NumPy import error in Jupyter Notebook?
Jupyter kernels can reference a different Python installation than your system default. Run !which python (Linux/Mac) or !where python (Windows) inside a notebook cell to identify the active interpreter path. Then install NumPy directly from a cell using !pip install numpy to ensure it targets that specific interpreter. After installation, restart the kernel before importing again. Once NumPy loads correctly, you can start working with arrays immediately — operations like appending Python lists to NumPy arrays become straightforward from there.
Does reinstalling Python fix persistent NumPy import failures?
Reinstalling Python is a last resort and usually unnecessary. Instead, create a fresh virtual environment with python -m venv myenv, activate it, and install NumPy cleanly. This isolates dependencies and avoids conflicts with system-level packages. If you use Anaconda, conda create -n fresh_env numpy achieves the same result. Check that your PATH variable does not contain references to old or broken Python installations, as these often cause the interpreter to load the wrong site-packages directory.