[Solved] Install Poppler for Python on Mac

I need to extract pdf annotations in Python. All my searches indicate I need Poppler to do this e.g. to run this

But I am having a lot of trouble installing Poppler. I’m using Python 3.4 on OS X (Yosemite). Here’s what I’ve tried so far:
1. pip

pip3 install python-poppler-qt4

which gives

ImportError: No module named 'sipdistutils'

2. Next I tried

pip3 install pypoppler

And got

NameError: name 'file' is not defined

3. Next I tried downloading from here
Same error as 1. I searched for sipdistutils and found this which I thought might be it. I copied it to the folder and tried pip again. This time I got

File "/python-poppler-qt4-0.24.0/sipdistutils.py", line 32
raise RuntimeError, "cannot parse SIP-generated '%s'" % sbf

4. Next I tried downloading from here and building using ./configure, which gave:

checking for PYPOPPLER... configure: error: Package requirements (                          pygtk-2.0 >= 2.10.0,
                     atk >= 1.6.0,
                     poppler-glib >= 0.12
                     ) were not met:

No package 'pygtk-2.0' found
No package 'atk' found
No package 'poppler-glib' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you 
installed software in a non-standard prefix.   

5. Macports

sudo port install py34-poppler-qt4

Error: Failed to install poppler
Please see the log file for port poppler for details:

Error: The following dependencies were not installed: poppler-qt4-mac poppler qt4-mac dbus libmng lcms py34-pyqt4 dbus-python34 dbus-glib python34 python3_select py34-sip

I feel I am very close with several of these approaches – and that something very small would sort this out.

Enquirer: simmons


Solution #1:

The following still works (October 2019)

brew install poppler
Respondent: Vishal

Solution #2:

Installing Homebrew and pasting the receipe for poppler in terminal worked for me. OS-x sierra

Respondent: Nico Vink

Solution #3:

Short Answer

Use conda:

conda install poppler

Longer Answer

In my experience, conda is the best solution for installing Python packages which have external (non-Python) dependencies. There are two options for installing conda, either the full Anaconda distribution or the minimalist Miniconda utility. I prefer Miniconda, which can be installed by running a Bash script, found here:

Miniconda Mac OSX Installers

After installing Miniconda, you typically create a new environment and then activate it, e.g.:

conda create --name py37 python=3.7
conda activate py37

Then you can install packages within the active Conda environment using conda e.g. to install poppler:

conda install poppler

You can also install packages using pip, e.g. to install pdftotext – a package which depends on poppler:

pip install pdftotext
Respondent: igal

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.