title: Why can't my container find a pip installed package (via git)?
body: <p>I have a Dockerfile</p>
  
  <pre><code>FROM ubuntu:xenial
  LABEL maintainer="info@martin-thoma.com"
  
  # Settings for the local user to create
  ENV APP_USER docker
  ENV APP_USER_UID 9999
  ENV APP_USER_GROUP docker
  ENV APP_USER_GROUP_GID 4711
  ENV PYTHONIOENCODING utf-8
  
  # Install and update software
  RUN apt-get update -y &amp;&amp; apt-get install -y --fix-missing git python-pip python-dev build-essential poppler-utils libmysqlclient-dev
  RUN pip install pip --upgrade
  
  # Copy projects code
  COPY . /opt/app
  WORKDIR /opt/app
  RUN pip install -r requirements.txt
  
  # Create user
  RUN groupadd --gid ${APP_USER_GROUP_GID} ${APP_USER_GROUP} \
   &amp;&amp; useradd --uid ${APP_USER_UID} --create-home -g ${APP_USER_GROUP} ${APP_USER} \
   &amp;&amp; chown -R $APP_USER:$APP_USER_GROUP /opt/app
  
  # Start app
  USER docker
  RUN mkdir -p /opt/app/filestorage
  ENTRYPOINT ["python"]
  CMD ["app.py"]
  </code></pre>
  
  <p>and a <code>requirements.txt</code></p>
  
  <pre><code>-e git+https://github.com/ecederstrand/exchangelib.git@85eada6d59d0e2c757ef17c6ce143f3c976d2a90#egg=exchangelib
  Flask==0.12.2
  fuzzywuzzy==0.15.1
  </code></pre>
  
  <p>When I change the <code>exchangelib</code> line to <code>exchangelib</code> (hence not using git, but the version on PyPI) it works (but my code doesn't work as I need some of the recent changes).</p>
  
  <p>When I have this, I get:</p>
  
  <pre><code>web_1  | ImportError: No module named exchangelib
  </code></pre>
  
  <p>What is the problem? <strong>Why can't my container find a pip installed package (via git)?</strong> How do I fix it?</p>
  
  <p>My intuition is that the problem is that I install it as the root user, but the application runs as another user. The PyPI packages seem to get installed for all users while the editable is only local. But I still don't know how to fix it.</p>