No module named flask using virtualenv

Make sure your virtualenv is activated. Then You check on the PYTHONPATH of that virtualenv. Is there a flask package (folder) installed in that directory.

If you unsure whether you have installed flask, just run the following command to see all the packages you have installed pip list or pip show flask. Do you see flask there? If not you can run pip install flask


This error can also appear if you start your Flask python server using ./run.py or similarly use file associations to start your server. Then the python command in the association will be used instead of your virtual environment python command. Use python run.py instead. See how my run.py innocently assumes /usr/bin/python?

#!/usr/bin/python
# run.py
from app import app
app.run(debug=True,host='0.0.0.0',port=5000)