title: PDFInfoNotInstalledError AWS Lambda can't find Poppler path with pdf2image
body: <p>Following the guide here: <a href="https://www.petewilcock.com/using-poppler-pdftotext-and-other-custom-binaries-on-aws-lambda/" rel="nofollow noreferrer">https://www.petewilcock.com/using-poppler-pdftotext-and-other-custom-binaries-on-aws-lambda/</a> I was able to get the binaries using EC2. But now for the last step, I cannot seem to find a way to get pdf2image to use the poppler path. Getting error:</p>
  
  <pre><code>  "errorMessage": "Unable to get page count. Is poppler installed and in PATH?",
    "errorType": "PDFInfoNotInstalledError",
  </code></pre>
  
  <p>What I've tried:</p>
  
  <ol>
  <li>Adding a lambda layer with the package.zip from that guide, then
  calling <code>convert_from_bytes()</code> with no poppler_path</li>
  <li>Adding a lambda layer with the package.zip from that guide, then calling <code>convert_from_bytes()</code> with poppler_path = '/opt/lib/'</li>
  <li>Adding the /lib and /bin directory directly into my lambda and calling <code>convert_from_bytes()</code> with poppler_path = '/var/task/lib/'</li>
  <li><p>Adding a lambda layer with the package.zip from that guide and adding the environment variable PATH mapped to /opt/ 
   4a. Doing the same thing and mapping it to /opt/lib/</p>
  
  <p>4b. Doing the same thing and mapping it to /opt/bin/</p></li>
  </ol>
  
  <p>My lambda for one of the above: </p>
  
  <pre><code>import json
  import base64
  import os
  from uuid import uuid4
  from pdf2image import convert_from_bytes
  
  POPPLER_PATH = '/opt/lib/'
  
  def text_process_handler(event, context):
      document = bucketHelper.get_bucket_object('&lt;Bucket&gt;', '&lt;document&gt;.pdf')
      images = convert_from_bytes(document,dpi=150, poppler_path=POPPLER_PATH)
  
      return {
          "statusCode": 200,
          "body": json.dumps({
              "message": "Successful request."
          }),       
      }
  </code></pre>
  
  <p>My <code>package.zip</code> looks like:</p>
  
  <pre><code>+--lib
  |  +--libpoppler.so.70
  |  +--libtiff.so.5
  |  +--etc...
  +--bin
  |  +--pdftoppm
  |  +--pdftotext
  |  +--etc...
  
  </code></pre>