1

AWS lambda is able to find my function in handler settings and certain libraries I have installed in the root folder, but is unable to find other libraries like pyodbc and google.cloud.storage.

Error: START RequestId: 607f59cb-44a9-11e7-82c2-813a7578fcd0 Version: $LATEST Unable to import module 'push_to_s3': No module named pyodbc

Jackery Xu
  • 386
  • 2
  • 5
  • 19
  • Is there a pyodbc packaged with your Labda? Can you show us an overview of the Lambda packaging? – stdunbar May 29 '17 at 20:20
  • @stdunbar yes, i just ran 'pip install pyodbc -t .' in the folder I zipped and it added both the pyodbc.pyd file and the pyodbc-4.0.16.dist-info folder – Jackery Xu May 29 '17 at 20:24
  • https://stackoverflow.com/a/64327675/2506172 should be relevant here. – narayan Oct 13 '20 at 02:41

1 Answers1

1

You might need to pre-compile the pyodbc lib using the specific AMI Lambda uses (AMI name: amzn-ami-hvm-2016.03.3.x86_64-gp2).

Here the install instructions on Linux:

https://learn.microsoft.com/en-us/sql/connect/python/pyodbc/step-1-configure-development-environment-for-pyodbc-python-development

Here are more details about native libraries on Lambda env.:

http://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html

Here some other things you might consider while creating your deployment packages:

http://joarleymoraes.com/hassle-free-python-lambda-deployment/

joarleymoraes
  • 1,891
  • 14
  • 16