title: Is there a way to fix numpy error on lamda aws?
body: <p>I'm trying to import numpy library on a lambda AWS these are the steps:</p>
  
  <pre><code>layer=numpy
  mkdir -p $layer/python/lib/python3.7/site-packages/
  cd $layer/python/lib/python3.7/site-packages/
  pip install -t . numpy
  cd ../../../../
  zip -r $layer.zip .
  </code></pre>
  
  <p>Here the error from lambda:</p>
  
  <blockquote>
    <p>[ERROR] Runtime.ImportModuleError: Unable to import module
    'lambda_function': </p>
    
    <p>IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!</p>
    
    <p>Importing the numpy c-extensions failed.
    - Try uninstalling and reinstalling numpy.
    - If you have already done that, then:
      1. Check that you expected to use Python3.7 from "/var/lang/bin/python3.7",
         and that you have no directories in your PATH or PYTHONPATH that can
         interfere with the Python and numpy version "1.17.3" you're trying to use.
      2. If (1) looks fine, you can open a new issue at
         <a href="https://github.com/numpy/numpy/issues" rel="nofollow noreferrer">https://github.com/numpy/numpy/issues</a>.  Please include details on:
         - how you installed Python
         - how you installed numpy
         - your operating system
         - whether or not you have multiple versions of Python installed
         - if you built from source, your compiler versions and ideally a build log</p>
    
    <ul>
    <li>If you're working with a numpy git repository, try <code>git clean -xdf</code>   (removes all files not under version control) and rebuild numpy.</li>
    </ul>
    
    <p>Note: this error has many possible causes, so please don't comment on
    an existing issue about this - open a new one instead.</p>
    
    <p>Original error was: No module named 'numpy.core._multiarray_umath'</p>
  </blockquote>
  
  <p>Here is the structure of my path:</p>
  
  <pre><code>.
  └── python
      └── lib
          └── python3.7
              └── site-packages
  </code></pre>
  
  <p>Thanks</p>
  
  <p><strong>SOLUTION:</strong></p>
  
  <pre><code>docker pull python:3.7-slim-buster
  docker run -it python:3.7-slim-buster bash
  cd home
  
  layer=boto3_cv2_pil
  mkdir -p $layer/python/lib/python3.7/site-packages/
  cd $layer/python/lib/python3.7/site-packages/
  pip install -t . boto3 opencv-python Pillow numpy==1.17.3 pytz
  cd ../../../../
  apt-get update
  apt-get install zip -y
  zip -r $layer.zip .
  
  docker cp $CONTAINER_ID:/home/boto3_cv2_pil.zip .
  </code></pre>