Error while trying to use pdf2image on heroku : libpng12.so.0: cannot open shared object file: No such file or directory

Question:

I get the Exception:
pdfinfo: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory

on the line
images = pdf2image.convert_from_path("filename.pdf")

I tried adding this buildpack, but it didn’t solve the problem.

Asked By: Ceres

||

Answers:

had the same issue and solved it as follows:

  1. Remove the libpng buildback and the poppler utils buildback
  2. Create an Aptfile in the root directory of your project and add libpng-dev and poppler-utils to the file
  3. Add the official heroku api buildback heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt
  4. Push a new version of your app to Heroku.
Answered By: Carl Bednorz
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.