title: AWS Lambda in Python fail to import module
body: <p>I have a very simple Python I need to use as an AWS Lambda function:</p>
  
  <pre><code>import pyodbc
  
  
  def lambda_handler():
  cnxn = pyodbc.connect("Driver={SQL Server Native Client 11.0};"
                        "Server=AAA;"
                        "Database=BBB;"
                        "UID=CCC;"
                        "PWD=DDD;")
  cursor = cnxn.cursor()
  cursor.execute("INSERT INTO [dbo].[log]([opened_by_id],[open_timestamp],[type_id],[title]) VALUES(118,GETDATE(),1,'test_1')")
  cnxn.commit()
  </code></pre>
  
  <p>I've installed pyodbc using pip and have it as a folder where the py file is. both the py file and the pyodbc folder are added to a zip file that I've uploaded to Lambda functions Console. When I test the function I receive an error:</p>
  
  <pre><code>START RequestId: XXX Version: $LATEST
  Unable to import module 'detect_last_sample': No module named 'pyodbc'
  
  END RequestId: XXX
  REPORT RequestId: YYY   Duration: 1.24 ms   Billed Duration: 100 ms     Memory Size: 128 MB Max Memory Used: 21 MB  
  </code></pre>
  
  <p>Please help me understand what am I missing here. Many thanks!</p>
  
  <p>--EDIT
   Looks like there's more to this issue then simply creating a zip with the external libs, there is an issue with pyodbc itself when used in aws lambda.
  Anyway during my searches I found this repo containing pre complied libraries including pyodbc : <a href="https://github.com/Miserlou/lambda-packages" rel="nofollow noreferrer">https://github.com/Miserlou/lambda-packages</a></p>
  
  <p>Good luck to all.</p>