I am building a Python Lambda function code to be executed on AWS (Linux).
My Dev machine is not Linux.
If I do pip install, I am getting Windows/MacOS related modules.
Is there a way to fetch Linux based dependencies always? Such as a CLI argument for target architecture.
I just had the exact same problem with Lambda, Python, and trying to get Pillow to work. After much searching around, I came across this article that explained the problem, and provided a great solution.
https://medium.freecodecamp.org/escaping-lambda-function-hell-using-docker-40b187ec1e48
Basically, you can run docker on your Mac, which allows you to run a Linux instance. Then using pip, install whatever library you want to use. You can then include those files in your ZIP file and upload it to Lambda. Works like a charm.
These docker images approximate the AWS Lambda environment pretty accurately. You can use them to create packages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With