Trying to successfully run numpy on AWS Lambda. The information I have read indicates that you need to use numpy libraries specifically compiled/compatible with AWS EC2.
Do do this I first followed the instruction to compile numpy on an ec2 instance, here:
Installing numpy on Amazon EC2
I then copied the newly built numpy into my Lambda application folder on my desktop, zipped up a Lambda deployment package containing the entire directory.
Upon running my Lambda function I still get this error:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try git clean -xdf
(removes all files not under version control). Otherwise reinstall numpy.
Suggestion?
Adding an answer for anyone who finds this old question.
Luckily, this problem has now been solved with Lambda Layer. AWS even provides a NumPy and SciPy layer. You can attach it directly to your Lambda in the web console or use this ARN arn:aws:lambda:us-east-1:668099181075:layer:AWSLambda-Python36-SciPy1x:2
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