Search code examples
pythonamazon-web-servicesaws-lambdapython-wheel

How to include .whl files in zip for lambda function


Ok...I have spent a good amount of time trying to figure this out. The easiest way to include dependencies for python in lambda functions seems to be a download of the .whl file from pyPI (https://aws.amazon.com/premiumsupport/knowledge-center/lambda-python-package-compatible/), unzipping, and including the contents which are compiled on a version on linux compatible with what AWS is running.

Simple question, answer no where to be found. On a WINDOWS machine, how can we uncompress the contents of the .whl for inclusion in a zip file with our python scripts?? I'm desperately looking for a step-by-step but nothing is out there...very frustrated.


Solution

  • Lambda functions are run on Linux machines, which is why the guide tells you to download the manylinux wheels.

    You can do the packaging (following the steps in the article you've linked) just as well on Windows, so long as you make sure to download and extract manylinux wheels, not Windows wheels.

    EDIT: bringing this up from the comments – .whls are just plain old .zips, so you can rename them to .zip and extract.