Search code examples
python-3.xamazon-web-servicesaws-lambdapython-imaging-library

How to manage Pillow package in lambda function?


I get this like error in my lambda function; I have uploaded the entire package but I got same error:

enter image description here

Exception: You don't have PIL installed. Please install PIL or Pillow>=8.1.1

How can I install PIL on lambda?


Solution

  • Use a pre-packaged Lambda layer, such as the ones found in this repository. The specific link will depend on your region and your Lambda's Python version.

    Alternatively, you can package the layer yourself. The official guide also uses Pillow as an example.