Search code examples
pythonpikepdf

I had a problem with python library pikepdf


When trying to install the python moduel pikepdf using pip, this error pops up:

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
  ╰─> [54 lines of output]
      ...
      creating build\temp.win-amd64-cpython-310\Release\src\qpdf
      "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPOINTERHOLDER_TRANSITION=4 -IC:\Users\ME\AppData\Local\Temp\pip-build-env-dpc9ltd5\overlay\Lib\site-packages\pybind11\include "-IC:\Program Files\Python310\include" "-IC:\Program Files\Python310\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /EHsc /Tpsrc/qpdf\annotation.cpp /Fobuild\temp.win-amd64-cpython-310\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\\2019\\Professional\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\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

Creating the wheel fails due to a missing header file:

src/qpdf\annotation.cpp(4): fatal error C1083: Cannot open include file: 'qpdf/Constants.h': No such file or directory

This is for pikepdf v6.0.0. My previous version was v4.0.1.post1, which worked fine.

Is this something that can be remedied from my side?


Solution

  • Solution for Macbook, M1

    brew install qpdf
    

    After it use

    pip install pikepdf
    

    Solution from https://github.com/pikepdf/pikepdf/issues/274