title: What is the correct way to add pandas/scikit-learn packages to your project for use in AWS lambda
body: <p>I am doing all the steps that are mentioned in the following document:
  <a href="http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html" rel="noreferrer">http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html</a></p>
  
  <p>I am usign amazon's ec2 with amazon linux on it to build the package.</p>
  
  <p>I also tried doing steps that are mentioned in 
  <a href="https://markn.ca/2015/10/python-extension-modules-in-aws-lambda/" rel="noreferrer">https://markn.ca/2015/10/python-extension-modules-in-aws-lambda/</a></p>
  
  <p>Following is the error i get when the package is uploaded to AWS lambda and run:</p>
  
  <pre><code>START RequestId: cbfe0762-8f1b-11e5-9a1d-49fb4d3a0d13 Version: $LATEST
  Unable to import module 'test': No module named pandas
  
  END RequestId: cbfe0762-8f1b-11e5-9a1d-49fb4d3a0d13
  REPORT RequestId: cbfe0762-8f1b-11e5-9a1d-49fb4d3a0d13  Duration: 0.35 ms   Billed Duration: 100 ms     Memory Size: 128 MB Max Memory Used: 23 MB  
  </code></pre>
  
  <p>The error doesn't give any specific indication.</p>
  
  <p>Edit with more details:</p>
  
  <p>Hi @maxymoo</p>
  
  <p>I am just creating the zip of the contents. Not the folder that holds the .py file. When i try to add "requests" package with my .py file it works fine. Now when i try to add "pandas" package with my .py file then it gives me the above error.</p>
  
  <p>Following are the steps that i am following:</p>
  
  <ol>
  <li><p>Connect to ec2 with amazon linux running it.</p></li>
  <li><p>start virtualenv</p></li>
  <li><p>install pandas using "pip install pandas"</p></li>
  <li><p>go to "/home/ec2-user/t1/lib/python2.7/site-packages" directory</p></li>
  <li><p>take all the contents of "/home/ec2-user/t1/lib/python2.7/site-packages" add my test.py file to it and create the zip file</p></li>
  <li><p>upload the zip file to amazon lambda</p></li>
  <li><p>Run test</p></li>
  </ol>
  
  <p>I get the following error:</p>
  
  <pre><code>START RequestId: feee67de-8f2f-11e5-bc34-bd42a1d7326b Version: $LATEST
  Unable to import module 'test': No module named pandas
  
  END RequestId: feee67de-8f2f-11e5-bc34-bd42a1d7326b
  REPORT RequestId: feee67de-8f2f-11e5-bc34-bd42a1d7326b  Duration: 0.34 ms   Billed Duration: 100 ms     Memory Size: 128 MB Max Memory Used: 29 MB  
  </code></pre>
  
  <p>The contents of test.py is:</p>
  
  <pre><code>import json
  
  import requests
  
  import pandas as pd
  
  
  print('Loading function')
  
  
  def lambda_handler(event, context):
  
      #print("Received event: " + json.dumps(event, indent=2))
  
      print("value1 = " + event['key1'])
  
      print("value2 = " + event['key2'])
  
      print("value3 = " + event['key3'])
  
      return event['key1']  # Echo back the first key value
  
      #raise Exception('Something went wrong')
  </code></pre>
  
  <p>Following are the files in the zip file:</p>
  
  <pre><code>drwxrwxr-x  52 pds  staff     1768 Nov 19 17:09 setuptools
  
  drwxrwxr-x  32 pds  staff     1088 Nov 19 17:09 requests
  
  drwxrwxr-x  34 pds  staff     1156 Nov 19 17:10 pip
  
  drwxrwxr-x  11 pds  staff      374 Nov 19 17:10 setuptools-12.0.5.dist-info
  
  drwxrwxr-x  10 pds  staff      340 Nov 19 17:10 pip-6.0.8.dist-info
  
  drwxrwxr-x   8 pds  staff      272 Nov 19 17:10 requests-2.8.1.dist-info
  
  drwxrwxr-x   6 pds  staff      204 Nov 19 17:10 pkg_resources
  
  drwxrwxr-x   6 pds  staff      204 Nov 19 17:10 _markerlib
  
  -rw-r--r--@  1 pds  staff      374 Nov 19 17:15 test.py
  
  -rw-r--r--   1 pds  staff  3912745 Nov 19 17:16 Archive.zip
  
  -rw-r--r--   1 pds  staff      315 Nov 19 18:09 easy_install.pyc
  
  drwxrwxr-x   9 pds  staff      306 Nov 19 18:09 pytz-2015.7.dist-info
  
  -rw-r--r--   1 pds  staff    30098 Nov 19 18:10 six.py
  
  -rw-r--r--   1 pds  staff      126 Nov 19 18:10 easy_install.py
  
  drwxrwxr-x   8 pds  staff      272 Nov 19 18:11 six-1.10.0.dist-info
  
  drwxrwxr-x  15 pds  staff      510 Nov 19 18:11 pytz
  
  drwxrwxr-x   9 pds  staff      306 Nov 19 18:11 python_dateutil-2.4.2.dist-info
  
  -rw-r--r--   1 pds  staff    29545 Nov 19 18:11 six.pyc
  
  drwxrwxr-x  17 pds  staff      578 Nov 19 18:11 dateutil
  </code></pre>