You must include libjpeg.so in your lambda package, but it will also require some configuration using the patchelf utility. Assuming you are preparing a lambda package through " pip install module-name -t " (and not through virtualenv ), follow these steps:
cd into/your/local/lambda/package/dir cp -L $(ldd PIL/_imaging.so|grep libjpeg|awk '{print $3}') PIL/ patchelf --set-rpath PIL PIL/_imaging.so
This script works for Pillow version 3.2.0.
Regarding patchelf : under Ubuntu there may be 'apt install' ed, but under other Linuxes it may be necessary to build from the source .
source share