Modulenotfounderror no module named ‘numpy’ jupyter

The modulenotfounderror no module named ‘numpy’ jupyter is an error message if you are using Jupyter notebook.

In this article, we will showcase the solution for modulenotfounderror: no module named numpy on various platforms.

Stick to this article until the end of the discussion because we will explain everything that you need to know.

At the end of this discussion, you’ll know what are the various reason why does this error occur.

And how you are going to troubleshoot this error modulenotfounderror no module named numpy.

What is modulenotfounderror: no module named ‘numpy’ jupyter?

ModuleNotFoundError: No module named 'numpy'

The error message modulenotfounderror: no module named ‘numpy,’ that occurs in Jupyter Notebook when you are trying to import the numpy module.

It indicates that the “numpy” module was unable to be found by the Jupyter that is required to run the program.

In order to solve this error, you have to install the “numpy” module.

The “numpy” module is one of the popular libraries in Python that is used for scientific computations, and you have to install it on your computer to run your Python programs.

What are the reasons for modulenotfounderror: no module named ‘numpy’ jupyter?

These are the possible reasons why you are facing an error right now that should be fixed immediately if you want to run your program:

1. Numpy module is not installed

It is the common reason why the error modulenotfounderror: no module named numpy occurs.

When you did not install numpy, certainly Jupyter will not find it when you are running your notebook.

2. Incorrect environment

The error happens when you are using your Jupyter notebook in an incorrect environment.

3. Path issues

When the module path is not set up correctly, Jupyter cannot find the NumPy module.

This usually happens when you install the module in a non-standard location.

As a result, an error occurs because Jupyter relies on the Python path in order to locate the module numpy.

How to fix the error modulenotfounderror: no module named ‘numpy’ jupyter

Time needed: 2 minutes

Here are the effective solutions for this error modulenotfounderror no module named ‘numpy’ jupyter.

Open your command prompt (Windows) or terminal (MacOS or Linux).

Then, execute the following command:

  1. Install numpy module

    Installing the module in your system is the first step to fixing the error.

    You just have to select the appropriate command for the platform you are using, okay

    This command is for Jupyter Notebook:

    Install numpy module in Jupyter notebook

    If you are using Python 2 or in a virtual environment, the following command is perfect for you:

    Install numpy

    If you are using Python 3:

    Install numpy in python 3

    If you are using Anaconda:

    Install numpy module in Anaconda

    If you are using py alias (Windows):

    Install numpy module using py alias

    When you get permissions error:

    sudo pip3 install numpy
    pip install numpy –user

    When you don’t have pip in your PATH environment variable, use this command:

    →python -m pip install numpy

  2. Check the module if it is installed 

    Simply check if you have the numpy module installed using the following command:

    Check the module if it is installed 

  3. Install the module in a Virtual Environment

    When you are using a virtual environment ensure that you install the numpy in your virtual environment.

    To activate on Unix or MacOS
    source venv/bin/activate

    To activate on Windows (cmd.exe)
    venv\Scripts\activate.bat

    To activate on Windows (PowerShell)
    venv\Scripts\Activate.ps1


    If you are done activating the virtual environment, you can install the module using the command below:

    To install numpy in virtual environment:

    pip install numpy

  4. Upgrade Python version

    If you are using an older version of python then you should upgrade it by using the command below:

    pip install –upgrade pip

  5. Upgrade Jupyter Notebook module

    Sometimes the error cannot be resolved because the module is needed for an upgrade.

    For pip:
    pip install -U jupyter

    For conda:
    conda update jupyter

  6. Reinstalling the module

    When the solutions above do not resolve the issue, you must try to reinstall the module.

    To uninstall:
    pip3 uninstall numpy

    To install:
    pip3 install numpy

Conclusion

The module not found error: modulenotfounderror no module named ‘numpy is an error in Jupyter Notebook.

Luckily, with the step-by-step solutions in this article, you can easily resolve this error and be able to run your program smoothly.

We also have solutions if you encounter an error like “modulenotfounderror no module named ‘sklearn’ spyder.”

Thank you very much for reading until the end of this article.

Leave a Comment