title: "decoder jpeg not available" with Pillow on AWS Elastic Beanstalk
body: <p>i'm having some trouble to handle jpeg files on Python under AWS Elastic Beanstalk.</p>
  
  <p>I have this on .ebextensions/python.config file:</p>
  
  <pre><code>packages:
   yum:
    libjpeg-turbo-devel: []
    libpng-devel: []
    freetype-devel: []
  ...
  </code></pre>
  
  <p>So i believe i have libjpeg installed and working (i tried libjpeg-devel, but yum can't find this package).</p>
  
  <p>Also, i have this on my requirements.txt:</p>
  
  <pre><code>Pillow==2.5.1
  ...
  </code></pre>
  
  <p>So i believe i have Pillow installed and working on my environment. </p>
  
  <p>Then, since i have Pillow and libjpeg, i'm trying to do some work using PIL.Image in a Python script and save to a file. Like this:</p>
  
  <pre><code>from PIL import Image
  
  def resize_image(image,new_size,crop=False,correctOrientationSize=False):
    assert type(new_size) == dict
    assert new_size.has_key('width') and new_size.has_key('height')
  
    THUM_SIZE = [new_size['width'],new_size['height']]
  
    file_like = cStringIO.StringIO(base64.decodestring(image))
    thumbnail = Image.open(file_like)
  
    (width,height) = thumbnail.size
    if correctOrientationSize and height &gt; width:
      THUM_SIZE.reverse()
  
    thumbnail.thumbnail(THUM_SIZE)
  
    if crop:
      # Recorta imagem
      thumbnail = crop_image(thumbnail)
    output = cStringIO.StringIO()
    thumbnail.save(output,format='jpeg')
  
  return output.getvalue().encode('base64')
  </code></pre>
  
  <p>However, when i try to run it on Elastic Beanstalk's instance, the exception "decoder jpeg not available" when it calls .save() method.</p>
  
  <p>If i SSH into my instance, it works just fine and i already tried to rebuild the environment.</p>
  
  <p>What am i doing wrong?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>As suggested, i SSHed again into the instance and reinstalled Pillow through pip (/opt/python/run/venv/bin/pip), not before i has had sure libjpeg-devel was on environment before Pillow. </p>
  
  <p>I ran selftest.py and it confirmed that i had support for jpeg. So, in a last try, i went to "Restart App Server" on Elastic Beanstalk interface. It worked. </p>
  
  <p>Thank you all.</p>