Join my Laravel for REST API's course on Udemy 👀

Resolving `ModuleNotFoundError: No module named 'numpy'`

April 3, 2021  ‐ 1 min read

When you encounter the error ModuleNotFoundError: No module named 'numpy' you most likely have not, or not correctly, installed numpy.

If you haven't installed it yet you can do so by running:

$ python3 -m pip install numpy

Assuming that python still refers to a version of python 2 on your machine. Otherwise there is no need to run the install with python3.

The problem lies somewhere else if the above install command displays a line like:

Requirement already satisfied: numpy in /home/koen/.local/lib/python3.8/site-packages (1.20.2)

In that case numpy is actually installed but python just cannot seem to find it. Possible causes can be:

  • that you run your python code with a different python version for which you installed numpy.
  • that not yet activated your python virtual environment yet.
  • not yet select the right python interpreter in your code editor