Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:
        /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_graphics_poppler/poppler/main.log

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.

like image 224
simmons Avatar asked Aug 24 '15 07:08

simmons


2 Answers

The following still works (October 2019)

brew install poppler
like image 165
Vishal Avatar answered Sep 20 '22 15:09

Vishal


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

like image 45
Nico Vink Avatar answered Sep 20 '22 15:09

Nico Vink