Online Tutorials & Training Materials | STechies.com
Register Login

modulenotfounderror: no module named 'numpy'

05 May 2020 5:42 am || 0

While working with NumPy, a Python package for scientific computing, programmers may encounter an error modulenotfounderror no module named 'numpy'. This happens when the NumPy package is not properly installed on your system.

In this article, we will look at this error a little more closely and try to fix it.

modulenotfounderror no module named 'numpy': Solutions

Case 1

This error may occur when there is a problem with the version of Python installed on the system. Suppose you are trying to work with an older version of Python or NumPy, then the error will be encountered. Thus, it is best to always download and use the latest version for Python and NumPy.

Case 2

There can be another issue, where there may be two versions of Python installed on your system. It is better to keep the latest version such as Python 3 and uninstall the other version.

You can use the following code for Windows systems:

pip install numpy

Case 3

If you are facing the modulenotfounderror while shifting your code from Windows to Linux, use the following code to fix the error:

sudo apt-get install python-pip python3-pip
sudo pip3 install -U numpy

Make sure you always know the version of Python installed on your system. Use the code below to verify the version:

python --version