DEV Community

loading...

Discussion on: Convert any .pdf file 📚 into an audio 🔈 book with Python

Collapse
ash_wanth profile image
Ashwanth

I am really intrigued by this article. I tried everything to install pdftotext lib on my mac but was unsuccessful. I keep getting this error --> " error: command 'gcc' failed with exit status 1"
I installed OS dependencies , Poppler using brew but didn't work. Can you anyone help me?

Collapse
nezhar profile image
Harald Nezbeda

Have you tried to install the OS dependencies as specified in the docs? github.com/jalan/pdftotext#macos

Collapse
mustafaanaskh99 profile image
Mustafa Anas Author

make sure you have these two installed:
python-dev
libevent-dev

Collapse
ash_wanth profile image
Ashwanth

Yup i installed them . NO matter what i do, i keep getting this error --> "ERROR: Command errored out with exit status 1"
and i installed gcc too!

Thread Thread
redeving profile image
Kelvin Thompson

I just started getting the same thing on my system (Ubuntu). After a lot of Google/StackExchange, this worked (copy from my annotations):

For whatever reason, in order to install the following two, I had to install some stuff on my Ubuntu Mate ** system-wide ** to get rid of compile errors:

sudo apt-get install python3-setuptools python3-dev libpython3-dev
sudo apt-get update
sudo apt-get install build-essential libpoppler-cpp-dev pkg-config python-dev

I'm using PyCharmCE. After the above, I could use this in the PyCharm terminal:

pip3 install pdftotext
pip3 install gtts

After I did all of that, successful! Program works like a charm (hehe).

Cheers!

Thread Thread
mustafaanaskh99 profile image
Mustafa Anas Author

Thanks for sharing your solution!

Thread Thread
redeving profile image
Kelvin Thompson

A pleasure to finally be able to give back a little!

Thread Thread
ash_wanth profile image
Ashwanth

I have a Mac, brother. Can't use app-get. what should i do now?

Thread Thread
davidsouza profile image
David Souza

Are you using the default Python 2.7?? You may need to use Python 3.x

Thread Thread
davidsouza profile image
David Souza

I got this working on the Mac using Python 3.7.4 using virtual env and brew. Works fine.

Thread Thread
jogeshpi03 profile image
Jogesh

I am using docker with my Macbook without any issue. And it is a great alternative to start working on any environment, stack, etc.

Collapse
maskedman99 profile image
Rohit Prasad

They mention what all has to be installed for various O.S's in here pypi.org/project/pdftotext/