The Error “Import error: No module named numpy”, is an error that is invoked when you are working on python and are trying to install the numpy package in your windows system by using the import command in python.
Given below is the snippet of the error you might get:
Import error: No module named numpy
The error “Import error: No module named numpy” is seen because numpy module is not properly installed in your system and you are trying to use it in your project.
There are higher chances that might be you have two different versions of Python installed on your machine, and when you run ‘pip3 install numpy’ command, a certain version of Python was used to install the numpy package, but another Python version was used when you tried to import numpy.
To fix the error, “Import error: No module named numpy” you will have to use the NumPy version 1.5.0 or above, as support for Python 3 is added into Numpy starting from version 1.5.0.
You can also manually install numpy using the command ‘python3 -m pip install numpy’. It would fix the Import error: No module named numpy error.
First, you will have to use pip installer as, in NumPy 1.5.0 version support for Python 3 was included.
To do so you will have to follow the code mentioned below:
python3 -m pip install numpy
If the above solution does not work you can also manually install numpy in your system by following the steps mentioned:
Install Numpy in Windows Machine:
Step 1: Open the Windows command prompt as an administrator.
Simply press the Windows key. Enter the “cmd” key .
Choose “Run as Administrator” from the context menu when you right-click the suggested “Command Prompt.”
Step 2: Use the “cd” (change directory) command to get to the Scripts folder in the Python installation directory.
For instance you can use something like the following”cd C:Program Files (x86)PythonXXScripts,”
Step 3: Then finally use the “pip install numpy” command.
You should get something like below mentioned to know that you have successfully installed numpy:
Collecting numpy
Downloading numpy-1.13.3-2-cp27-none-win32.whl (6.7MB)
100% |################################| 6.7MB 112kB/s
Installing collected packages: numpy
Successfully installed numpy-1.13.3
Once Numpy version 1.5.0 or above is installed properly into your system, and path is set properly, it would fix the error, “Import error: No module named numpy”
Conclusion
To fix the error, “Import error: No module named numpy” you will have to use the NumPy version 1.5.0 or above, as support for Python 3 is added into Numpy starting from version 1.5.0.
You can also manually install numpy using the command ‘python3 -m pip install numpy’. It would fix the Import error: No module named numpy error.