ModuleNotFoundError: No module named 'flask'

pip can for some reason point to system-wide pip (which on many systems corresponds to Python 2.7). In order to use pip from the virtualenv, use python -m pip command. The following command will do the trick:

pip uninstall flask && python -m pip install flask

Another possibility is that you installed flask via apt and not pip. Here's the difference between the two: What is the difference between `sudo apt install python3-flask` and `pip3 install Flask`?

So now the flask command is available system-wide.

If this is the case, uninstalling flask with apt and installing it with pip should do the trick:

sudo apt remove python-flask
pip install flask

(this is my guess that the apt package is called python-flask.

Tags:

Python

Flask