Importerror: no module named flask error comes when the python interpreter does not have a flask package ( Install in the host machines ). We also get the same error when the flask python package is there (install) but its path is not set. Well, In this article we will see how to install the flask package in different ways.
Importerror: no module named flask : (Solution) –
We have already discussed the root cause of this error. Let’s start the Falsk together.

pip package manager –
We can install the Flask module using pip manager with the below command.
pip install flask
In case you need to install Flask in python 3 specifically/. We may try this command –
pip install flask
We can add sudo for admin rights or in case you need to install Flask for all user in the place of a particular user ( Linux family OS only ).
sudo pip install flask
sudo pip3 install flask
You have seen in some scenarios we installed the pip but the location/path is not correct. If you have the same position.
python -m pip install flask
Using system Manager –
Just like pip, We can install the flask module using apt-get or yum manager. Here is the command.
apt-get install python-flask
yum install python-flask
Using conda manager –
As we all know that conda is a default package manager. We can use this conda manager for installing Flask manager.
conda install flask
Flask is the micro web framework. We all widely use Flask for the quick creation of Rest APIs endpoints. Unlike other web frameworks, we need not do so many configurations for project setup. We can also use flask for the production server and deployment with a few added libraries.
Conclusion –
Importerror: no module named flask error is very common among developers. But I hope this article, must have solved your doubt. Please comment below if you have any concern related to this error.
Thanks
Data Science Learner Team
Join our list
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.