title: Using Pillow in Docker
body: <p>I am not able to install python's PIL module in docker for some reason. Here's a description of what I have:</p>
  
  <p><strong>requirements.txt</strong></p>
  
  <pre><code>Pillow
  flask
  redis
  </code></pre>
  
  <p><strong>Dockerfile</strong></p>
  
  <pre><code>FROM python:2.7
  ADD . /code
  WORKDIR /code
  RUN pip install -r requirements.txt
  CMD python app.py
  </code></pre>
  
  <p><strong>app.py</strong></p>
  
  <pre><code>import PIL
  </code></pre>
  
  <p><strong>Commands</strong></p>
  
  <pre><code>$ sudo docker build -t web .
  Installing collected packages: Pillow, Werkzeug, MarkupSafe, Jinja2, itsdangerous, flask, redis
  Successfully installed Jinja2-2.8 MarkupSafe-0.23 Pillow-2.9.0  Werkzeug-0.10.4 flask-0.10.1 itsdangerous-0.24 redis-2.10.3
  ---&gt; 91dfb38bd480
  Removing intermediate container 4e4ca5801814
  Step 4 : CMD python app.py
   ---&gt; Running in e71453f2fab6
   ---&gt; d62996658bd6
   Removing intermediate container e71453f2fab6
   Successfully built d62996658bd6
  
  $ sudo docker-compose up
  </code></pre>
  
  <p>Here's what I get:
  <strong>Output</strong></p>
  
  <pre><code>web_1   |   File "app.py", line 1, in &lt;module&gt;
  web_1   |     import PIL
  web_1   | ImportError: No module named PIL
  </code></pre>
  
  <p>I thought maybe adding <strong>PIL</strong> in requirements.txt would work, but here's what happens when I build </p>
  
  <pre><code>$ sudo docker build -t web .
  ....
  Collecting PIL (from -r requirements.txt (line 1))
  Could not find a version that satisfies the requirement PIL (from -r    requirements.txt (line 1)) (from versions: )
  Some externally hosted files were ignored as access to them may be  unreliable (use --allow-external PIL to allow).
  No matching distribution found for PIL (from -r requirements.txt (line 1))
  </code></pre>
  
  <p>Any idea what should be done from here? </p>