title: AWS Lambda function does not recognize my Python dependency layer
body: <p>My goal is to upload a small layer for an aws lambda function using the python 3.7 runtime that stores python dependencies, but I cannot seem to get it to recognize the modules.</p>
  <p>I created a <strong>Makefile</strong> to generate the zip file</p>
  <pre><code>create-lambda-layer:
      docker run -dit --name AL amazonlinux:latest
      docker cp requirements.in AL:/root/requirements.in
      docker exec -it AL bash -c &quot;yum update -y \
          &amp;&amp; yum install -y python3.7 zip  \ 
          &amp;&amp; python3 -m pip install --upgrade pip \
          &amp;&amp; pip install wheel \
          &amp;&amp; mkdir -p /root/lambda/ \
          &amp;&amp; pip install -r /root/requirements.in -t /root/lambda/ \
          &amp;&amp; cd /root/lambda/ \
          &amp;&amp; zip -r python.zip .&quot;
      docker cp AL:/root/lambda/python.zip .
      docker stop AL
      docker rm AL
  </code></pre>
  <p>and my required modules are in <strong>requirements.in</strong> in the same folder</p>
  <pre><code>holidays==0.11.2
  python-gitlab==2.10.1
  </code></pre>
  <p>I put the layer in a service and deploy it via the serverless framework, but I also tested to upload the same .zip directly using the AWS console and it failed. My lambda function source file (linked correctly to the layer) is solely:</p>
  <pre><code>import gitlab
  import holidays
  
  print(&quot;holidays: &quot;, holidays.__version__)
  print(&quot;gitlab&quot;, gitlab.__version__)
  
  def lambda_handler(event, context): 
      return()
  </code></pre>
  <p>I get the following errors (analogously for holidays):</p>
  <pre><code>{
    &quot;errorMessage&quot;: &quot;Unable to import module 'lambda_function': No module named 'gitlab'&quot;,
    &quot;errorType&quot;: &quot;Runtime.ImportModuleError&quot;,
    &quot;stackTrace&quot;: []
  }
  </code></pre>
  <p>The content of my python.zip is not remarkable to me, it just contains the dependencies it should:</p>
  <pre><code>PyMeeus-0.5.11.dist-info            hijri_converter                        pytz-2021.1.dist-info
  __pycache__                         hijri_converter-2.2.1.dist-info        requests
  bin                                 holidays                               requests-2.26.0.dist-info
  certifi                             holidays-0.11.2.dist-info              requests_toolbelt
  certifi-2021.5.30.dist-info         idna                                   requests_toolbelt-0.9.1.dist-info
  charset_normalizer                  idna-3.2.dist-info                     six-1.16.0.dist-info
  charset_normalizer-2.0.4.dist-info  korean_lunar_calendar                  six.py
  convertdate                         korean_lunar_calendar-0.2.1.dist-info  tests
  convertdate-2.3.2.dist-info         pymeeus                                urllib3
  dateutil                            python_dateutil-2.8.2.dist-info        urllib3-1.26.6.dist-info
  docs                                python_gitlab-2.10.1.dist-info
  gitlab                              pytz
  </code></pre>
  <p>I wonder why this is. I have previously tried to create the same layer zip using ubuntu and it worked, but to implement it officially, I cannot use an ubuntu image.</p>
  <p>Does anyone have an idea what I can do to track down the problem or how to solve this? Could it have any impact that I use <code>pip</code> as root while installing the dependencies?</p>
  <p>Thanks!</p>