AWS Lambda - unable to import module 'lambda_function'

The problem is that your local numpy and pandas are compiled for the local machine's architecture. Since AWS Lambda uses custom Linux, they are probably not compatible.

So if you want to use them, you have two choices:

  • Compile dependencies on EC2 instance which uses the same Amazon Linux version as AWS Lambda and create a deployment package.

  • Use one of the precompiled packages from here

P.S. I've read comments on a post, so I see that the name of the file and function is ok and numpy is giving you trouble.


The solution was zipping numpy and scipy precompiled packages from this source.