title: ModuleNotFound when running an app in Docker
body: <p>I've got a Python3 Flask app, and I want to put it to container. I've added Flask to requirements.txt, and it works locally, but fails to find "flask" module when in container. What am I doing wrong?</p>
  
  <p>requirements.txt:</p>
  
  <pre><code>aniso8601==7.0.0
  certifi==2019.6.16
  chardet==3.0.4
  Click==7.0
  Flask==1.1.1
  Flask-RESTful==0.3.7
  idna==2.8
  itsdangerous==1.1.0
  Jinja2==2.10.1
  MarkupSafe==1.1.1
  pymongo==3.8.0
  pytz==2019.1
  requests==2.22.0
  six==1.12.0
  urllib3==1.25.3
  Werkzeug==0.15.4
  </code></pre>
  
  <p>Minimal working <code>app.py</code>:</p>
  
  <pre><code>from flask import Flask
  from flask_restful import Api
  app = Flask(__name__)
  api = Api(app)
  
  if __name__ == '__main__':
      app.run(host="0.0.0.0", port=8080)
  </code></pre>
  
  <p>Dockerfile:</p>
  
  <pre><code>FROM python:3.7-alpine
  WORKDIR /usr/src/app
  RUN apk add --no-cache \
          uwsgi-python3
  COPY . .
  ENV TESTING TRUE
  RUN pip3 install --no-cache-dir -r requirements.txt
  CMD [ "uwsgi", "--socket", "0.0.0.0:3031", \
                 "--uid", "uwsgi", \
                 "--plugins", "python3", \
                 "--protocol", "uwsgi", \
                 "--wsgi", "app:app", \
                 "-p", "4", \
                 "--enable-threads"]
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>*** Operational MODE: preforking ***
  Traceback (most recent call last):
    File "./app.py", line 5, in &lt;module&gt;
      from flask import Flask, request, Response
  ModuleNotFoundError: No module named 'flask'
  unable to load app 0 (mountpoint='') (callable not found or import error)
  *** no app loaded. going in full dynamic mode ***
  *** uWSGI is running in multiple interpreter mode ***
  </code></pre>
  
  <p><a href="https://gist.github.com/keddad/5b329a6c88e63ed84742cb47c6d4b11c" rel="nofollow noreferrer">Example</a> of app.py (too big to add to question)</p>
  
  <p>Project structure:</p>
  
  <pre><code>├── app.py
  ├── docker-compose.yml
  ├── Dockerfile
  ├── LICENSE
  ├── logging_config.ini
  ├── nginx.conf
  ├── __pycache__
  │   └── utils.cpython-37.pyc
  ├── README.md
  ├── requirements.txt
  ├── testing_data
  │   ├─- some jsons here
  ├── tests.py
  └── utils.py
  </code></pre>