Scipy is a free and open-source python module. It contains a large number of inbuilt mathematical functions that can easily do scientific and technical computing. But many beginners get the error modulenotfounderror: no module named ‘scipy’. If you are also getting this error , then this entire post is for you. In this entire tutorial, you will learn how to solve the issue of modulenotfounderror: no module named ‘scipy’.
ModuleNotFoundError is a runtime error. Most of the coders get this error when the package is not installed in your system. Suppose you are using the python package A then you will get the error ModuleNotFoundError : no module named ‘A’ , if it is not installed in your system.
In the next section, you will know the root cause of the error and how to solve it.
The main and root cause of the modulenotfounderror: no module named ‘scipy’ error is that you have not installed the scipy package in your system. For example, you will get the red underline below the word scipy as you have not installed the package in the pycharm environment.
import scipy
Output
The same error you will get when you will try to import in the terminal or command prompt.
The solution for this error is very simple. You have to install scipy in your system. To install it you have to use the pip command. Which pip version you will use depends upon the python version in your system. If your python version is 3. xx then use pip3 and if 2. xx then use the pip command.
To check the version of python, use the below line of a bash command.
python --version
Output
My system has 3. xx version, so I will use the pip3 command.
Open your command prompt or terminal and type the below command to install scipy package.
pip3 install scipy
Now if you again import the scipy then you will not get the modulenotfounderror: no module named ‘scipy’ in your system.
These are the methods to solve this no module named scipy error. I hope you have liked this tutorial. If you have any queries then you can contact us for more help.