How Do You Troubleshoot the Error “ModuleNotFoundError: No module named ‘flask'”?

Problem scenario
You are running a Python program or running a command from the Python 3 interpreter. You get this error:

Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'flask'

What should you do to use Flask with Python 3?

You need to have pip3 installed. You can do it with this if you are using Debian/Ubuntu Linux:

sudo apt-get -y install python3-pip

Install Flask with pip3. Here is the command you should run: pip3 install flask

Leave a comment

Your email address will not be published. Required fields are marked *