title: Unable to import module 'lambda_function': No module named 'pandas'
body: <blockquote>
    <p>START RequestId: 3d5691d9-ad79-4eed-a26c-5bc3f1a23a99 Version: $LATEST
    Unable to import module 'lambda_function': No module named 'pandas'<br>
    END RequestId: 3d5691d9-ad79-4eed-a26c-5bc3f1a23a99</p>
  </blockquote>
  
  <p>I'm using Windows 7 64-bit as the host OS.</p>
  
  <h3>What I want to do</h3>
  
  <p>I simply want to use pandas in AWS-Lambda environment. Just like I use it in windows environment, I am looking for a simple solution for Lambda.</p>
  
  <h3>What I have tried so far</h3>
  
  <ul>
  <li>Installed Xubuntu on a virtual box. </li>
  <li>Create a virtual environment called <code>myvenv</code> in Xubuntu on virtual-box. </li>
  <li>Then I installed pandas3.6 in <code>myvenv</code>. </li>
  <li>Thereafter, I copied the folder contents in <code>myvenv</code> at location <code>'/usr/local/lib/python3.6/site-packages/'</code> to my host OS.</li>
  <li>In the host OS (windows 7), I created a folder called <code>packs</code>, pasted the contents of <code>myvenv</code>.</li>
  <li>created a <code>lambda_function.py</code> script in <code>packs</code> in host OS (windows 7)</li>
  <li>I then zipped the folder <code>packs</code> using 7zip software and upload it as <code>zip</code> in <code>Lambda</code></li>
  <li>In Lambda, the lambda function handler name is, <code>lambda_handler()</code>. The code snippet looks like,</li>
  </ul>
  
  <blockquote>
    <p>import pandas as pd</p>
  
  <pre><code>def lambda_handler(event, context):
  
      dates = pd.date_range('2019001', periods=6)
  
      df = pd.DataFrame(np.random.randn(6, 4), index=dates, columns=list('ABCD'))
      print(df)
  </code></pre>
  </blockquote>
  
  <ul>
  <li>The handler is named as <code>lambda_function.lambda_handler</code>. I have given the lambda-role <code>AWSLambdaFullAccess</code> permission.</li>
  <li>The time out is set to 4 min and 3 sec.</li>
  <li><p>The test event looks like</p>
  
  <p>{
    "key1": "This will be printed if all OK"
  }</p></li>
  </ul>
  
  <p>I have tried the following solutions:</p>
  
  <ul>
  <li>Tried precompiled linux-compatible binaries for pandas &amp; numpy from <a href="https://github.com/ryfeus/lambda-packs/tree/master/Pandas_numpy" rel="noreferrer">here</a> -- no luck.</li>
  <li>In Lambda, changed the <code>Handler info</code> to <em>python_filename.function_name</em>. For my case, it was <em>lambda_function.lambda_handler</em> -- <strong>failed with no module named 'pandas' error</strong>.</li>
  <li>placed the lambda function in the root folder, zipped the folder using 7zip software and upload the folder to the S3 bucket. For my case, I placed the function at location <code>python\lib\python3.6\site_packages\lambda_function.py</code><strong>failed with no module named 'pandas' error</strong>.</li>
  <li>Already tried these related solutions posted on SO, <a href="https://stackoverflow.com/questions/36054976/pandas-aws-lambda?noredirect=1&amp;lq=1">1</a>, <a href="https://stackoverflow.com/questions/43877692/pandas-in-aws-lambda-gives-numpy-error?noredirect=1&amp;lq=1">2</a>, <a href="https://joarleymoraes.com/hassle-free-python-lambda-deployment/" rel="noreferrer">3</a>, <a href="https://stackoverflow.com/questions/35340921/aws-lambda-import-module-error-in-python">4</a>, <a href="https://stackoverflow.com/questions/46283082/aws-lambda-unable-to-import-module?noredirect=1&amp;lq=1">5</a>, <a href="https://stackoverflow.com/questions/30670957/creating-a-lambda-function-in-aws-from-zip-file">6</a></li>
  </ul>
  
  <p>Note: I do not want to use Docker, because I do not know how to use it and I'm not willing to learn it as I'm exasperated now. I'm coming from a windows environment (<em>it sucks, I now know.</em>)</p>
  
  <p>Any ideas on how to get this to work.</p>