title: Unable to import Pandas in AWS Lambda
body: <p>I am new to AWS Lambda and I want to run code on Lambda for a machine learning API. The functions that I want to run on Lambda are, in summary, one to read some csv files to create a pandas dataFrame and search in it and the other to run some pickled machine learning models through requests from a Flask application. To do this, I need to import pandas, joblib and possibly scikit-learn which are compatible with Amazon Linux. I am using a Windows machine.</p>
  
  <p>In general, I am going with the approach of using Lambda's layers by uploading zip files. Of course, since Lambda has a pre-built layer with SciPy and Numpy so I will not import them. If I import them, I will exceed Lambda's layer limit anyway.
  To be more specific, I have done the following:</p>
  
  <ul>
  <li>Downloaded and extracted linux-compatible versions of the libraries listed  above. For example: From this    <a href="https://pypi.org/project/pandas/#files" rel="nofollow noreferrer">link</a> I have downloaded    "pandas-0.25.0-cp35-cp35m-manylinux1_x86_64.whl" and unzipped to a    folder.</li>
  <li><p>The unzipped libraries are in the following directory:</p>
  
  <blockquote>
    <p>lambda_layers\python\lib\python3.7\site-packages</p>
  </blockquote></li>
  <li><p>They are zipped into a file and uploaded onto S3 Bucket for creating a layer.</p></li>
  </ul>
  
  <p>I imported the packages:</p>
  
  <pre class="lang-py prettyprint-override"><code>import json
  import boto3
  import pandas as pd
  </code></pre>
  
  <p>I got the following error from Lambda:</p>
  
  <blockquote>
    <p>{
      "errorMessage": "Unable to import module 'lambda_function': C extension: No module named 'pandas._libs.tslibs.conversion' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.",
      "errorType": "Runtime.ImportModuleError"
    }</p>
  </blockquote>