Error invoking Python based AWS Lambda: /var/task/torch/_C.so: invalid ELF header

I’m trying to package a Python based Lambda to AWS but when my Python handler is called, I get this error:

Unable to import module 'helloworld-lambda': /var/task/torch/_C.so: invalid ELF header

Searching around it appears some Python modules are platform specific, so when running ‘pip install –target’ to install modules on MacOS before zipping up and deploying as a Lambda, it appears this installs platform specific libraries that are not compatible with the AWS Lambda runtime.

I’ll try packaging up my app on Linux and then try again.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.