No module named flask while running uWSGI

In the end what worked for me was adding -H /path/to/virtualenv to the uWSGI command:

uwsgi --http-socket :3031 --plugin python --wsgi-file myflaskapp.py --callable app -H /path/to/virtualenv

I also had different Python versions in the virtualenv and for uWSGI. I'm still investigating if this could cause any problems.


I ran into same problem once, as there was some version conflict

then instead of using pip to install uwsgi I did it by my package manager On ubuntu machine,

sudo apt-get install uwsgi

Also check and run myflaskapp.py without uwsgi that is by using app.run() in your code

*Note : That will be by werkzeug server.


I faced similar problem and found the reason that if we have a module installed in a virtual environment(Flask in this case) we may need to add --virtualenv path in addition to the basic instructions needed to run a Flask app using uWSGI

So the instruction according the uWSGI document would be:

uwsgi --http-socket :3031 --plugin python --wsgi-file myflaskapp.py --callable app --virtualenv /path_to_virtualenv