question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip3 install ocrmypdf : "Failed building wheel for pikepdf" + 'i686-linux-gnu-gcc' failed with exit status 1

See original GitHub issue

So i am trying to install the latest version of ocrmypdf with pip3 (as apt-get offers only a much older version 6.x), followed by a couple of errors.

Python 2.7.1.6 and 3.6.8 are installed, including the corresponding dev packages. Really don’t know how to overcome this problem 😕

lubuntu@lubuntu-pc:~$ pip3 install ocrmypdf
Collecting ocrmypdf
  Using cached https://files.pythonhosted.org/packages/e2/67/6824ed4b624e944c471e76d316fedb4daa31f8f1d99246163a60e11e5984/ocrmypdf-8.3.0-py35-none-any.whl
Collecting pikepdf<2,>=1.3.0 (from ocrmypdf)
  Using cached https://files.pythonhosted.org/packages/04/a0/0951cda6ebdf3d205af9b177250382e3c149a96b82d0ce75e984310488e1/pikepdf-1.3.0.tar.gz
Collecting ruffus>=2.7.0 (from ocrmypdf)
Collecting img2pdf<0.4,>=0.3.0 (from ocrmypdf)
Collecting cffi>=1.9.1 (from ocrmypdf)
  Using cached https://files.pythonhosted.org/packages/5b/a6/7e590b12e023e7e7d4068d7198e10a0ac71dcb3bcd9b7a994ab3b5e29ece/cffi-1.12.3-cp36-cp36m-manylinux1_i686.whl
Collecting reportlab>=3.3.0 (from ocrmypdf)
  Using cached https://files.pythonhosted.org/packages/d4/db/832a82e288659a1f64b1a9489dfdd9d07b18b09a7b9da1294fe2d43d1a8f/reportlab-3.5.21-cp36-cp36m-manylinux1_i686.whl
Collecting chardet<4,>=3.0.4 (from ocrmypdf)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting pdfminer.six==20181108; sys_platform != "darwin" (from ocrmypdf)
  Using cached https://files.pythonhosted.org/packages/8a/fd/6e8746e6965d1a7ea8e97253e3d79e625da5547e8f376f88de5d024bacb9/pdfminer.six-20181108-py2.py3-none-any.whl
Collecting lxml>=4.0 (from pikepdf<2,>=1.3.0->ocrmypdf)
  Using cached https://files.pythonhosted.org/packages/91/fd/2d2adb8c6592b803b50859205a2dcb07355f289c69d1c2e1b7fced05c299/lxml-4.3.3-cp36-cp36m-manylinux1_i686.whl
Collecting Pillow (from img2pdf<0.4,>=0.3.0->ocrmypdf)
  Using cached https://files.pythonhosted.org/packages/51/01/a16c3c3c652b55c70738e22ce42a88fbfc1afad5edf1632be9c810a3dbdd/Pillow-6.0.0-cp36-cp36m-manylinux1_i686.whl
Collecting pycparser (from cffi>=1.9.1->ocrmypdf)
Collecting six (from pdfminer.six==20181108; sys_platform != "darwin"->ocrmypdf)
  Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting sortedcontainers (from pdfminer.six==20181108; sys_platform != "darwin"->ocrmypdf)
  Using cached https://files.pythonhosted.org/packages/13/f3/cf85f7c3a2dbd1a515d51e1f1676d971abe41bba6f4ab5443240d9a78e5b/sortedcontainers-2.1.0-py2.py3-none-any.whl
Collecting pycryptodome (from pdfminer.six==20181108; sys_platform != "darwin"->ocrmypdf)
  Using cached https://files.pythonhosted.org/packages/2c/09/a91aacf54b2b835efea77f5a26613e53216a12e0643a1dcae6fb5ee3e49c/pycryptodome-3.8.1-cp36-cp36m-manylinux1_i686.whl
Building wheels for collected packages: pikepdf
  Running setup.py bdist_wheel for pikepdf ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-nvm5mh1d/pikepdf/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpl93hqfxapip-wheel- --python-tag cp36:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-i686-3.6
  creating build/lib.linux-i686-3.6/pikepdf
  copying src/pikepdf/_cpphelpers.py -> build/lib.linux-i686-3.6/pikepdf
  copying src/pikepdf/__init__.py -> build/lib.linux-i686-3.6/pikepdf
  copying src/pikepdf/_methods.py -> build/lib.linux-i686-3.6/pikepdf
  copying src/pikepdf/_version.py -> build/lib.linux-i686-3.6/pikepdf
  copying src/pikepdf/objects.py -> build/lib.linux-i686-3.6/pikepdf
  creating build/lib.linux-i686-3.6/pikepdf/models
  copying src/pikepdf/models/matrix.py -> build/lib.linux-i686-3.6/pikepdf/models
  copying src/pikepdf/models/__init__.py -> build/lib.linux-i686-3.6/pikepdf/models
  copying src/pikepdf/models/metadata.py -> build/lib.linux-i686-3.6/pikepdf/models
  copying src/pikepdf/models/image.py -> build/lib.linux-i686-3.6/pikepdf/models
  running build_ext
  creating tmp
  i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c /tmp/tmp4gh97y7h.cpp -o tmp/tmp4gh97y7h.o -std=c++14
  i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c /tmp/tmp84ilosug.cpp -o tmp/tmp84ilosug.o -fvisibility=hidden
  building 'pikepdf._qpdf' extension
  creating build/temp.linux-i686-3.6
  creating build/temp.linux-i686-3.6/src
  creating build/temp.linux-i686-3.6/src/qpdf
  i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/python3.6 -I/home/lubuntu/.local/include/python3.6m -I/usr/include/python3.6m -c src/qpdf/object.cpp -o build/temp.linux-i686-3.6/src/qpdf/object.o -DVERSION_INFO="1.3.0" -std=c++14 -fvisibility=hidden
  src/qpdf/object.cpp:14:10: fatal error: qpdf/Constants.h: No such file or directory
   #include <qpdf/Constants.h>
            ^~~~~~~~~~~~~~~~~~
  compilation terminated.
  error: command 'i686-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for pikepdf
  Running setup.py clean for pikepdf
Failed to build pikepdf
Installing collected packages: lxml, pikepdf, ruffus, Pillow, img2pdf, pycparser, cffi, reportlab, chardet, six, sortedcontainers, pycryptodome, pdfminer.six, ocrmypdf
  Running setup.py install for pikepdf ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-nvm5mh1d/pikepdf/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-lm1927j7-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-i686-3.6
    creating build/lib.linux-i686-3.6/pikepdf
    copying src/pikepdf/_cpphelpers.py -> build/lib.linux-i686-3.6/pikepdf
    copying src/pikepdf/__init__.py -> build/lib.linux-i686-3.6/pikepdf
    copying src/pikepdf/_methods.py -> build/lib.linux-i686-3.6/pikepdf
    copying src/pikepdf/_version.py -> build/lib.linux-i686-3.6/pikepdf
    copying src/pikepdf/objects.py -> build/lib.linux-i686-3.6/pikepdf
    creating build/lib.linux-i686-3.6/pikepdf/models
    copying src/pikepdf/models/matrix.py -> build/lib.linux-i686-3.6/pikepdf/models
    copying src/pikepdf/models/__init__.py -> build/lib.linux-i686-3.6/pikepdf/models
    copying src/pikepdf/models/metadata.py -> build/lib.linux-i686-3.6/pikepdf/models
    copying src/pikepdf/models/image.py -> build/lib.linux-i686-3.6/pikepdf/models
    running build_ext
    i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c /tmp/tmpasoqgg_x.cpp -o tmp/tmpasoqgg_x.o -std=c++14
    i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c /tmp/tmpnfuf9sas.cpp -o tmp/tmpnfuf9sas.o -fvisibility=hidden
    building 'pikepdf._qpdf' extension
    creating build/temp.linux-i686-3.6
    creating build/temp.linux-i686-3.6/src
    creating build/temp.linux-i686-3.6/src/qpdf
    i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/include/python3.6 -I/home/lubuntu/.local/include/python3.6m -I/usr/include/python3.6m -c src/qpdf/object.cpp -o build/temp.linux-i686-3.6/src/qpdf/object.o -DVERSION_INFO="1.3.0" -std=c++14 -fvisibility=hidden
    src/qpdf/object.cpp:14:10: fatal error: qpdf/Constants.h: No such file or directory
     #include <qpdf/Constants.h>
              ^~~~~~~~~~~~~~~~~~
    compilation terminated.
    error: command 'i686-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-nvm5mh1d/pikepdf/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-lm1927j7-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-nvm5mh1d/pikepdf/                                          `

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

1reaction
jbarlow83commented, May 17, 2019

Oh, I see it now. You’re the first i686 (32-bit) Linux user. I don’t build binary wheels for pikepdf in 32-bit because I thought none of you were left 😃.

You’ll need to build the latest version of qpdf from source. See here: https://pikepdf.readthedocs.io/en/latest/installation.html#building-from-source

Ubuntu 18.10 doesn’t have a new enough version of qpdf. If you build and make install qpdf to /usr/local/include, that should do it, as in, it will provide the header files needed for pikepdf to build.

0reactions
LikeCartercommented, Feb 9, 2021

I found this on Reddit. Solved my issue:

"The compilation cannot succeed because it relies on your system having a particular library and the source code (or at least the description of the library’s interface), which is the header files it’s missing.

Probably, something like apt-get install libqpdf-dev will solve your problem."

Read more comments on GitHub >

github_iconTop Results From Across the Web

pip3 install ocrmypdf : "Failed building wheel for pikepdf" + ...
pip3 install ocrmypdf : "Failed building wheel for pikepdf" + 'i686-linux-gnu-gcc' failed with exit status 1 #389.
Read more >
Issue installing pikepdf module using pip : r/learnpython - Reddit
Failed building wheel for pikepdf. followed by a bunch of "compilation terminated." and then the following also highlighted in red:
Read more >
Installing OCRmyPDF - Read the Docs
First ensure you can build and install pikepdf. To install the HEAD revision from sources in the current Python 3 environment: pip install...
Read more >
Libraries like Pikepdf fail to build because of ... - Heptapod
Because of lines like the above, there is a problem while building these packages in pypy. The error is. In file included from...
Read more >
ocrmypdf Documentation - Read the Docs
Fixed build failure for the combination of PyPy 3.6 and pikepdf 3.0. ... pip install ocrmypdf[fitz] to use it to its full potential....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found