Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal error: qpdf/Constants.h - pip3 install ocrmypdf and pikepdf on ubuntu win10 subsystem failed #460

Closed
mhechthz opened this issue Dec 7, 2019 · 27 comments
Labels
user config Seems to be a problem specific to user configuration

Comments

@mhechthz
Copy link

mhechthz commented Dec 7, 2019

Hi,

there was a thread with the same problem that is closed meanwhile and did not solve my problem. I try to install ocrmypdf on ubuntu LTS 18.04 subsystem for Windows 10 I run into:

src/qpdf/annotation.cpp:11:10: fatal error: qpdf/Constants.h: No such file or directory #include <qpdf/Constants.h> ^~~~~~~~~~~~~~~~~~ compilation terminated.
and subsequent errors.

What can I do?

@jbarlow83
Copy link
Collaborator

jbarlow83 commented Dec 7, 2019 via email

@jbarlow83 jbarlow83 pinned this issue Dec 7, 2019
@jbarlow83 jbarlow83 changed the title pip3 install ocrmypdf and pikepdf on ubuntu win10 subsystem failed fatal error: qpdf/Constants.h - pip3 install ocrmypdf and pikepdf on ubuntu win10 subsystem failed Dec 7, 2019
@jbarlow83
Copy link
Collaborator

Pinned because this issue is common.

@jbarlow83 jbarlow83 added the user config Seems to be a problem specific to user configuration label Dec 12, 2019
@Jeparre
Copy link

Jeparre commented May 12, 2020

Try that:
python3 -m pip install --upgrade pip

Then:
python3 -m pip install pikepdf

@catx0rr
Copy link

catx0rr commented May 14, 2020

Thanks @Jeparre I was able to resolve the same issue.

@jbarlow83
Copy link
Collaborator

Some users may need to use a different approach than suggested by @Jeparre.

See the pip documentation here:
https://pip.pypa.io/en/stable/installing/

@ollie-zhang

This comment was marked as outdated.

@jbarlow83

This comment was marked as outdated.

@kaitosea916

This comment was marked as outdated.

@jbarlow83

This comment was marked as outdated.

@kaitosea916

This comment was marked as outdated.

@jbarlow83

This comment was marked as outdated.

@kaitosea916

This comment was marked as outdated.

@brje

This comment was marked as outdated.

@jbarlow83

This comment was marked as outdated.

@jbarlow83

This comment was marked as outdated.

@jbarlow83

This comment was marked as outdated.

@LikeCarter
Copy link

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.

@DUOLabs333
Copy link

For Arch Linux, installing qpdf should be enough.

@elysch
Copy link

elysch commented Nov 8, 2022

I'm facing this problem and haven't been able to overcome it.

I tried to overcome it by downloading qpdf-11.1.1.tar.gz. I took the "include\qpdf" directory and placed in the python include directory.

It now compiles, but just fails in the LINK process.
As soon as I can reach the machine where I'm trying to install again, I'll copy de exact error message.

Any help would be greatly appreciated

(Using Windows 10)

@jbarlow83
Copy link
Collaborator

@elysch If you're using Python 3.11, the lxml library has not released binary wheels for Windows yet, so I can't release pikepdf binary wheels. pikepdf should be installl to all other versions of Python on Windows without compiling.

The other exception would be if you're using Windows+ARM.

@Bohaska
Copy link

Bohaska commented Nov 9, 2022

@jbarlow83 I got the same problem. I'm on an Apple Silicon mac.
The exact error is this:

error: subprocess-exited-with-error
  
  × Building wheel for pikepdf (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [94 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.14-arm64-cpython-38
      creating build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/_methods.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/_version.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/__init__.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/_cpphelpers.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/jbig2.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/_xml.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/settings.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/objects.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/codec.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/_exceptions.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/_augments.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      creating build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/matrix.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/_transcoding.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/encryption.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/metadata.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/_content_stream.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/__init__.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/outlines.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/image.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      running egg_info
      writing src/pikepdf.egg-info/PKG-INFO
      writing dependency_links to src/pikepdf.egg-info/dependency_links.txt
      writing requirements to src/pikepdf.egg-info/requires.txt
      writing top-level names to src/pikepdf.egg-info/top_level.txt
      /private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/setuptools_scm/git.py:284: UserWarning: git archive did not support describe output
        warnings.warn("git archive did not support describe output")
      /private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/setuptools_scm/git.py:301: UserWarning: unexported git archival found
        warnings.warn("unexported git archival found")
      listing git files failed - pretending there aren't any
      reading manifest file 'src/pikepdf.egg-info/SOURCES.txt'
      adding license file 'LICENSE.txt'
      adding license file 'licenses-for-wheels.txt'
      writing manifest file 'src/pikepdf.egg-info/SOURCES.txt'
      copying src/pikepdf/_qpdf.pyi -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/py.typed -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      running build_ext
      building 'pikepdf._qpdf' extension
      creating build/temp.macosx-10.14-arm64-cpython-38
      creating build/temp.macosx-10.14-arm64-cpython-38/src
      creating build/temp.macosx-10.14-arm64-cpython-38/src/qpdf
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/annotation.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/annotation.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/embeddedfiles.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/embeddedfiles.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/logger.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/logger.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/job.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/job.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/nametree.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/nametree.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/numbertree.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/numbertree.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/object.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/object.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/object_convert.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/object_convert.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      src/qpdf/numbertree.cpp:4:10: src/qpdf/embeddedfiles.cpp:4:10: fatal error: 'qpdf/Constants.h' file not found
      src/qpdf/nametree.cpp:4:10: fatal error: 'qpdf/Constants.h' file not found
      src/qpdf/annotation.cpp:4:10: fatal error: 'qpdf/Constants.h' file not found
      fatal error: 'qpdf/Constants.h' file not found
      #include <qpdf/Constants.h>
               ^~~~~~~~~~~~~~~~~~
      #include <qpdf/Constants.h>#include <qpdf/Constants.h>#include <qpdf/Constants.h>
               ^~~~~~~~~~~~~~~~~~
      
               ^~~~~~~~~~~~~~~~~~
      
               ^~~~~~~~~~~~~~~~~~
      src/qpdf/object.cpp:7:10: fatal error: 'qpdf/Constants.h' file not found
      #include <qpdf/Constants.h>
               ^~~~~~~~~~~~~~~~~~
      In file included from src/qpdf/logger.cpp:4:
      src/qpdf/pikepdf.h:10:10: fatal error: 'qpdf/QPDF.hh' file not found
      #include <qpdf/QPDF.hh>
               ^~~~~~~~~~~~~~
      src/qpdf/object_convert.cpp:12:10: fatal error: 'qpdf/Constants.h' file not found
      #include <qpdf/Constants.h>
               ^~~~~~~~~~~~~~~~~~
      src/qpdf/job.cpp:6:10: fatal error: 'qpdf/QPDFJob.hh' file not found
      #include <qpdf/QPDFJob.hh>
               ^~~~~~~~~~~~~~~~~
      1 error generated.
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/object_repr.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/object_repr.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      error: command '/usr/bin/clang' failed with exit code 1
      1 error generated.
      1 error generated.
      1 error generated.
      1 error generated.
      1 error generated.
      1 error generated.
      1 error generated.
      src/qpdf/object_repr.cpp:19:10: fatal error: 'qpdf/Constants.h' file not found
      #include <qpdf/Constants.h>
               ^~~~~~~~~~~~~~~~~~
      1 error generated.```

@xiaopang0v0
Copy link

@jbarlow83我遇到了同样的问题。我在 Apple Silicon Mac 上。 确切的错误是这样的:

error: subprocess-exited-with-error
  
  × Building wheel for pikepdf (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [94 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.14-arm64-cpython-38
      creating build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/_methods.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/_version.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/__init__.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/_cpphelpers.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/jbig2.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/_xml.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/settings.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/objects.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/codec.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/_exceptions.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/_augments.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      creating build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/matrix.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/_transcoding.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/encryption.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/metadata.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/_content_stream.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/__init__.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/outlines.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      copying src/pikepdf/models/image.py -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf/models
      running egg_info
      writing src/pikepdf.egg-info/PKG-INFO
      writing dependency_links to src/pikepdf.egg-info/dependency_links.txt
      writing requirements to src/pikepdf.egg-info/requires.txt
      writing top-level names to src/pikepdf.egg-info/top_level.txt
      /private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/setuptools_scm/git.py:284: UserWarning: git archive did not support describe output
        warnings.warn("git archive did not support describe output")
      /private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/setuptools_scm/git.py:301: UserWarning: unexported git archival found
        warnings.warn("unexported git archival found")
      listing git files failed - pretending there aren't any
      reading manifest file 'src/pikepdf.egg-info/SOURCES.txt'
      adding license file 'LICENSE.txt'
      adding license file 'licenses-for-wheels.txt'
      writing manifest file 'src/pikepdf.egg-info/SOURCES.txt'
      copying src/pikepdf/_qpdf.pyi -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      copying src/pikepdf/py.typed -> build/lib.macosx-10.14-arm64-cpython-38/pikepdf
      running build_ext
      building 'pikepdf._qpdf' extension
      creating build/temp.macosx-10.14-arm64-cpython-38
      creating build/temp.macosx-10.14-arm64-cpython-38/src
      creating build/temp.macosx-10.14-arm64-cpython-38/src/qpdf
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/annotation.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/annotation.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/embeddedfiles.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/embeddedfiles.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/logger.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/logger.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/job.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/job.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/nametree.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/nametree.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/numbertree.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/numbertree.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/object.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/object.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/object_convert.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/object_convert.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      src/qpdf/numbertree.cpp:4:10: src/qpdf/embeddedfiles.cpp:4:10: fatal error: 'qpdf/Constants.h' file not found
      src/qpdf/nametree.cpp:4:10: fatal error: 'qpdf/Constants.h' file not found
      src/qpdf/annotation.cpp:4:10: fatal error: 'qpdf/Constants.h' file not found
      fatal error: 'qpdf/Constants.h' file not found
      #include <qpdf/Constants.h>
               ^~~~~~~~~~~~~~~~~~
      #include <qpdf/Constants.h>#include <qpdf/Constants.h>#include <qpdf/Constants.h>
               ^~~~~~~~~~~~~~~~~~
      
               ^~~~~~~~~~~~~~~~~~
      
               ^~~~~~~~~~~~~~~~~~
      src/qpdf/object.cpp:7:10: fatal error: 'qpdf/Constants.h' file not found
      #include <qpdf/Constants.h>
               ^~~~~~~~~~~~~~~~~~
      In file included from src/qpdf/logger.cpp:4:
      src/qpdf/pikepdf.h:10:10: fatal error: 'qpdf/QPDF.hh' file not found
      #include <qpdf/QPDF.hh>
               ^~~~~~~~~~~~~~
      src/qpdf/object_convert.cpp:12:10: fatal error: 'qpdf/Constants.h' file not found
      #include <qpdf/Constants.h>
               ^~~~~~~~~~~~~~~~~~
      src/qpdf/job.cpp:6:10: fatal error: 'qpdf/QPDFJob.hh' file not found
      #include <qpdf/QPDFJob.hh>
               ^~~~~~~~~~~~~~~~~
      1 error generated.
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DPOINTERHOLDER_TRANSITION=4 -I/private/var/folders/d2/3fxk2q7541q8yvbjfn2dkcj00000gn/T/pip-build-env-gs2t15dp/overlay/lib/python3.8/site-packages/pybind11/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -c src/qpdf/object_repr.cpp -o build/temp.macosx-10.14-arm64-cpython-38/src/qpdf/object_repr.o -fvisibility=hidden -g0 -stdlib=libc++ -std=c++17 -mmacosx-version-min=10.14
      error: command '/usr/bin/clang' failed with exit code 1
      1 error generated.
      1 error generated.
      1 error generated.
      1 error generated.
      1 error generated.
      1 error generated.
      1 error generated.
      src/qpdf/object_repr.cpp:19:10: fatal error: 'qpdf/Constants.h' file not found
      #include <qpdf/Constants.h>
               ^~~~~~~~~~~~~~~~~~
      1 error generated.```

In fact, all of the above are in vain.

What's really missing is the lxml package, which requires installing so many dependencies to build it, since it doesn't have a buildpack for the version of Python you're using.

In fact, all you have to do is go to this site

https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

Select your corresponding Python version in this website, then download the corresponding built lxml package, and you can install it normally.

The installation command is:

pip install xx.whl

After installing lxml, you will find that you can install pikepdf normally


其实这上面做的这些都是徒劳的。

真正缺少的是 lxml 这个软件包,因为它没有您使用的 Python 的版本的构建包,所以才需要安装如此多的依赖去构建它。

事实上,您只需要去这个网站

https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

在这个网站内选择您对应的 Python 版本,然后下载对应的构建好了的 lxml 程序包,就可以正常安装它了。

安装命令是:

pip install xx.whl

安装完 lxml 以后,你就会发现你可以正常安装 pikepdf 了。

@xiaopang0v0
Copy link

xiaopang0v0 commented Nov 19, 2022

我正面临这个问题,但一直无法克服。

我试图通过下载qpdf-11.1.1.tar.gz来克服它。我把“include\qpdf”目录放到了python的include目录下。

它现在可以编译,但只是在 LINK 过程中失败。 一旦我到达我尝试再次安装的机器,我将复制确切的错误消息。

任何帮助将不胜感激

(使用 Windows 10)

If you didn't solve this problem, you can try my solution


如果您没有解决这个问题的话,可以试试我的解决方案

@champlin2
Copy link

champlin2 commented Dec 27, 2022

@elysch If you're using Python 3.11, the lxml library has not released binary wheels for Windows yet, so I can't release pikepdf binary wheels. pikepdf should be installl to all other versions of Python on Windows without compiling.

The other exception would be if you're using Windows+ARM.

@jbarlow83 Has the lxml library been updated for Python 3.11.1 as I'm unable to get pikepdf to install with that version of Python on Windows Server 2019. It had worked fine on Python 3.9.6 on the same machine but upgrading Python to see if it resolves another issue.

python -m pip install pikepdf
Collecting pikepdf
  Using cached pikepdf-6.2.6.tar.gz (2.9 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting Pillow>=9.0
  Using cached Pillow-9.3.0-cp311-cp311-win32.whl (2.2 MB)
Collecting deprecation
  Using cached deprecation-2.1.0-py2.py3-none-any.whl (11 kB)
Requirement already satisfied: lxml>=4.8 in c:\python311-32\lib\site-packages (from pikepdf) (4.9.2)
Requirement already satisfied: packaging in c:\python311-32\lib\site-packages (from pikepdf) (22.0)
Building wheels for collected packages: pikepdf
  Building wheel for pikepdf (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pikepdf (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [52 lines of output]
      C:\Users\MMEadmin\AppData\Local\Temp\2\pip-build-env-f01r4mhj\overlay\Lib\site-packages\setuptools_scm\git.py:295: UserWarning: git archive did not support describe output
        warnings.warn("git archive did not support describe output")
      C:\Users\MMEadmin\AppData\Local\Temp\2\pip-build-env-f01r4mhj\overlay\Lib\site-packages\setuptools_scm\git.py:312: UserWarning: unexported git archival found
        warnings.warn("unexported git archival found")
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win32-cpython-311
      creating build\lib.win32-cpython-311\pikepdf
      copying src\pikepdf\codec.py -> build\lib.win32-cpython-311\pikepdf
      copying src\pikepdf\jbig2.py -> build\lib.win32-cpython-311\pikepdf
      copying src\pikepdf\objects.py -> build\lib.win32-cpython-311\pikepdf
      copying src\pikepdf\settings.py -> build\lib.win32-cpython-311\pikepdf
      copying src\pikepdf\_augments.py -> build\lib.win32-cpython-311\pikepdf
      copying src\pikepdf\_cpphelpers.py -> build\lib.win32-cpython-311\pikepdf
      copying src\pikepdf\_exceptions.py -> build\lib.win32-cpython-311\pikepdf
      copying src\pikepdf\_methods.py -> build\lib.win32-cpython-311\pikepdf
      copying src\pikepdf\_version.py -> build\lib.win32-cpython-311\pikepdf
      copying src\pikepdf\_xml.py -> build\lib.win32-cpython-311\pikepdf
      copying src\pikepdf\__init__.py -> build\lib.win32-cpython-311\pikepdf
      creating build\lib.win32-cpython-311\pikepdf\models
      copying src\pikepdf\models\encryption.py -> build\lib.win32-cpython-311\pikepdf\models
      copying src\pikepdf\models\image.py -> build\lib.win32-cpython-311\pikepdf\models
      copying src\pikepdf\models\matrix.py -> build\lib.win32-cpython-311\pikepdf\models
      copying src\pikepdf\models\metadata.py -> build\lib.win32-cpython-311\pikepdf\models
      copying src\pikepdf\models\outlines.py -> build\lib.win32-cpython-311\pikepdf\models
      copying src\pikepdf\models\_content_stream.py -> build\lib.win32-cpython-311\pikepdf\models
      copying src\pikepdf\models\_transcoding.py -> build\lib.win32-cpython-311\pikepdf\models
      copying src\pikepdf\models\__init__.py -> build\lib.win32-cpython-311\pikepdf\models
      running egg_info
      writing src\pikepdf.egg-info\PKG-INFO
      writing dependency_links to src\pikepdf.egg-info\dependency_links.txt
      writing requirements to src\pikepdf.egg-info\requires.txt
      writing top-level names to src\pikepdf.egg-info\top_level.txt
      listing git files failed - pretending there aren't any
      reading manifest file 'src\pikepdf.egg-info\SOURCES.txt'
      adding license file 'LICENSE.txt'
      adding license file 'licenses-for-wheels.txt'
      writing manifest file 'src\pikepdf.egg-info\SOURCES.txt'
      copying src\pikepdf\_qpdf.pyi -> build\lib.win32-cpython-311\pikepdf
      copying src\pikepdf\py.typed -> build\lib.win32-cpython-311\pikepdf
      running build_ext
      building 'pikepdf._qpdf' extension
      creating build\temp.win32-cpython-311
      creating build\temp.win32-cpython-311\Release
      creating build\temp.win32-cpython-311\Release\src
      creating build\temp.win32-cpython-311\Release\src\qpdf
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPOINTERHOLDER_TRANSITION=4 -IC:\Users\MMEadmin\AppData\Local\Temp\2\pip-build-env-f01r4mhj\overlay\Lib\site-packages\pybind11\include -IC:\Python311-32\include -IC:\Python311-32\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /EHsc /Tpsrc/qpdf\annotation.cpp /Fobuild\temp.win32-cpython-311\Release\src/qpdf\annotation.obj /EHsc /bigobj /std:c++17
      annotation.cpp
      src/qpdf\annotation.cpp(4): fatal error C1083: Cannot open include file: 'qpdf/Constants.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x86\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pikepdf
Failed to build pikepdf
ERROR: Could not build wheels for pikepdf, which is required to install pyproject.toml-based projects

@frahlg
Copy link

frahlg commented Jan 21, 2023

Ended up here because of build problems on my Mac. Fixed it by installing qpdf manually with brew. https://ports.macports.org/port/qpdf/

@thefirebanks
Copy link

thefirebanks commented Jan 24, 2023

@frahlg your solution worked for me (brew install qpdf), thank you!

I was having the same situation (problems with Mac M1 chip)

@NikiLentz
Copy link

For me installing ocrmypdf manually with brew and then doing a pip install worked with the same issue, not a perfect solution though, since my pip and python comes from pyenv and I am not using the brew python so I would have loved to not have to do the brew install step.

I am also on m1 pro, so I guess there are just no pre compiled arm sources for qpdf in the pip repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user config Seems to be a problem specific to user configuration
Projects
None yet
Development

No branches or pull requests