No module named flask using virtualenv No module named flask using virtualenv flask flask

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.pyfrom app import appapp.run(debug=True,host='0.0.0.0',port=5000)


I had this same problem on three Raspberry Pi units at the same time; beat my head against the wall trying to fix it for several hours (reinstall flask via pip, apt and aptitude - no joy).

Instead of:

pip install flask

I finally tried:

pip install Flask

Worked like a charm.