title: importing python package from AWS Lambda /tmp directory
body: <p>I am trying to upload a zip file, which contains mostly python packages, of size 300MB to AWS Lambda. I clearly understand that this exceeds the limit for the zip that can be uploaded to Lambda if we uploaded directly using AWS SDK. Therefore, this will not work.</p>
  
  <p>In order to overcome this, i decided to download the packages in the <code>/tmp</code> directory and import them to the main file (reference <a href="https://hackernoon.com/exploring-the-aws-lambda-deployment-limits-9a8384b0bec3" rel="noreferrer">here</a>). I compressed the required packages as <code>pkgs.zip</code> and upload it to AWS S3. Then I download them using <code>requests</code> extract them to <code>/tmp/</code>.</p>
  
  <pre><code>def get_pkgs(url):
      import requests
      import io
      import zipfile
      print("Getting Packages...")
      re = requests.get(url)
      z = zipfile.ZipFile(io.BytesIO(re.content))
      print("Extracting Packages...")
      z.extractall("/tmp/")
      print("Packages are downloaded and extracted.")
  
  def attempt_import():
      print("="*50)
      print("ATTEMPT TO IMPORT DEPENDENCIES...")
      print("="*50)
      import numpy
      import scipy
      import six
      print("IMPORTING DONE.")
  
  def main():
      URL = "https://s3-ap-southeast-1.amazonaws.com/BUCKET_NAME/pkgs.zip"
      get_pkgs(URL)
      attempt_import()
  
  def lambda_handler(event, context):
      main()
      return "Hello Lambda"
  </code></pre>
  
  <p>However, when i test the lambda function, it returns an error saying  that <code>numpy</code> cannot be found </p>
  
  <p><code>Import Error: No module named numpy</code></p>
  
  <p>My question is, <strong>How do I import the required packages from the <code>/tmp/</code> diretory?</strong></p>
  
  <p>Thanks in advance.</p>