MatthiasValvekens / pyHanko

pyHanko: sign and stamp PDF files
MIT License
483 stars 71 forks source link

Cannot install using pip #301

Closed janprzychodniak closed 1 year ago

janprzychodniak commented 1 year ago

Describe the bug I used the command provided here: https://github.com/MatthiasValvekens/pyHanko pip install 'pyHanko[pkcs11,image-support,opentype,xmp]'

The command either fails on python-pkcs11 or uharfbuzz

To Reproduce

To reproduce error with python-pkcs11:

  1. Run Windows Subsystem for Linux
  2. sudo apt-get update
  3. sudo apt install python3.10-venv
  4. python3 -m venv venv
  5. source venv/bin/activate
  6. pip install pyhanko[pkcs11,image-support,opentype,xmp]

To reproduce error with uharfbuzz:

  1. Run Windows Subsystem for Linux
  2. sudo apt-get update
  3. sudo apt install python3.10-venv
  4. python3 -m venv venv
  5. source venv/bin/activate
  6. Create requirements.txt file with following content:
    python-pkcs11==0.6.0
    pyhanko[pkcs11,image-support,opentype,xmp]
  7. pip install -r requirements.txt

Expected behavior For the package to install successfully.

Traceback For python-pkcs11:

/home/pdf-sign$ pip install 'pyHanko[pkcs11,image-support,opentype,xmp]'
Collecting pyHanko[image-support,opentype,pkcs11,xmp]
  Using cached pyHanko-0.20.0-py3-none-any.whl (407 kB)
Collecting pyhanko-certvalidator==0.23.*
  Using cached pyhanko_certvalidator-0.23.0-py3-none-any.whl (106 kB)
Requirement already satisfied: pyyaml>=5.3.1 in ./venv/lib/python3.10/site-packages (from pyHanko[image-support,opentype,pkcs11,xmp]) (6.0.1)
Requirement already satisfied: tzlocal>=4.3 in ./venv/lib/python3.10/site-packages (from pyHanko[image-support,opentype,pkcs11,xmp]) (5.0.1)
Requirement already satisfied: asn1crypto>=1.5.1 in ./venv/lib/python3.10/site-packages (from pyHanko[image-support,opentype,pkcs11,xmp]) (1.5.1)
Collecting cryptography>=3.3.1
  Using cached cryptography-41.0.3-cp37-abi3-manylinux_2_28_x86_64.whl (4.3 MB)
Requirement already satisfied: qrcode>=6.1 in ./venv/lib/python3.10/site-packages (from pyHanko[image-support,opentype,pkcs11,xmp]) (7.4.2)
Collecting requests>=2.24.0
  Using cached requests-2.31.0-py3-none-any.whl (62 kB)
Collecting click>=7.1.2
  Using cached click-8.1.6-py3-none-any.whl (97 kB)
Collecting defusedxml~=0.7.1
  Using cached defusedxml-0.7.1-py2.py3-none-any.whl (25 kB)
Requirement already satisfied: uharfbuzz<0.38.0,>=0.25.0 in ./venv/lib/python3.10/site-packages (from pyHanko[image-support,opentype,pkcs11,xmp]) (0.37.2)
Collecting fonttools>=4.33.3
  Using cached fonttools-4.42.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB)
Collecting python-pkcs11~=0.7.0
  Using cached python-pkcs11-0.7.0.tar.gz (106 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: python-barcode==0.15.1 in ./venv/lib/python3.10/site-packages (from pyHanko[image-support,opentype,pkcs11,xmp]) (0.15.1)
Collecting Pillow>=7.2.0
  Using cached Pillow-10.0.0-cp310-cp310-manylinux_2_28_x86_64.whl (3.4 MB)
Requirement already satisfied: uritools>=3.0.1 in ./venv/lib/python3.10/site-packages (from pyhanko-certvalidator==0.23.*->pyHanko[image-support,opentype,pkcs11,xmp]) (4.0.1)
Collecting oscrypto>=1.1.0
  Using cached oscrypto-1.3.0-py2.py3-none-any.whl (194 kB)
Collecting cffi>=1.12
  Using cached cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (441 kB)
Requirement already satisfied: cached-property in ./venv/lib/python3.10/site-packages (from python-pkcs11~=0.7.0->pyHanko[image-support,opentype,pkcs11,xmp]) (1.5.2)
Requirement already satisfied: pypng in ./venv/lib/python3.10/site-packages (from qrcode>=6.1->pyHanko[image-support,opentype,pkcs11,xmp]) (0.20220715.0)
Requirement already satisfied: typing-extensions in ./venv/lib/python3.10/site-packages (from qrcode>=6.1->pyHanko[image-support,opentype,pkcs11,xmp]) (4.7.1)
Requirement already satisfied: urllib3<3,>=1.21.1 in ./venv/lib/python3.10/site-packages (from requests>=2.24.0->pyHanko[image-support,opentype,pkcs11,xmp]) (2.0.4)
Collecting certifi>=2017.4.17
  Using cached certifi-2023.7.22-py3-none-any.whl (158 kB)
Collecting charset-normalizer<4,>=2
  Using cached charset_normalizer-3.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (201 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting pycparser
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Using legacy 'setup.py install' for python-pkcs11, since package 'wheel' is not installed.
Installing collected packages: python-pkcs11, pycparser, Pillow, oscrypto, idna, fonttools, defusedxml, click, charset-normalizer, certifi, requests, cffi, cryptography, pyhanko-certvalidator, pyHanko
  Running setup.py install for python-pkcs11 ... error
  error: subprocess-exited-with-error

  × Running setup.py install for python-pkcs11 did not run successfully.
  │ exit code: 1
  ╰─> [67 lines of output]
      /home/pdf-sign/venv/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
      WARNING: The wheel package is not available.
      WARNING: The wheel package is not available.
      WARNING: The wheel package is not available.
      WARNING: The wheel package is not available.
      running install
      /home/pdf-sign/venv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.10
      creating build/lib.linux-x86_64-3.10/pkcs11
      copying pkcs11/mechanisms.py -> build/lib.linux-x86_64-3.10/pkcs11
      copying pkcs11/__init__.py -> build/lib.linux-x86_64-3.10/pkcs11
      copying pkcs11/constants.py -> build/lib.linux-x86_64-3.10/pkcs11
      copying pkcs11/types.py -> build/lib.linux-x86_64-3.10/pkcs11
      copying pkcs11/defaults.py -> build/lib.linux-x86_64-3.10/pkcs11
      copying pkcs11/exceptions.py -> build/lib.linux-x86_64-3.10/pkcs11
      creating build/lib.linux-x86_64-3.10/pkcs11/util
      copying pkcs11/util/rsa.py -> build/lib.linux-x86_64-3.10/pkcs11/util
      copying pkcs11/util/dsa.py -> build/lib.linux-x86_64-3.10/pkcs11/util
      copying pkcs11/util/__init__.py -> build/lib.linux-x86_64-3.10/pkcs11/util
      copying pkcs11/util/dh.py -> build/lib.linux-x86_64-3.10/pkcs11/util
      copying pkcs11/util/x509.py -> build/lib.linux-x86_64-3.10/pkcs11/util
      copying pkcs11/util/ec.py -> build/lib.linux-x86_64-3.10/pkcs11/util
      running egg_info
      writing python_pkcs11.egg-info/PKG-INFO
      writing dependency_links to python_pkcs11.egg-info/dependency_links.txt
      writing requirements to python_pkcs11.egg-info/requires.txt
      writing top-level names to python_pkcs11.egg-info/top_level.txt
      listing git files failed - pretending there aren't any
      reading manifest file 'python_pkcs11.egg-info/SOURCES.txt'
      writing manifest file 'python_pkcs11.egg-info/SOURCES.txt'
      copying pkcs11/_errors.pyx -> build/lib.linux-x86_64-3.10/pkcs11
      copying pkcs11/_mswin.pxd -> build/lib.linux-x86_64-3.10/pkcs11
      copying pkcs11/_pkcs11.pyx -> build/lib.linux-x86_64-3.10/pkcs11
      copying pkcs11/_pkcs11_defn.pxd -> build/lib.linux-x86_64-3.10/pkcs11
      copying pkcs11/_utils.pyx -> build/lib.linux-x86_64-3.10/pkcs11
      running build_ext
      Compiling pkcs11/_pkcs11.pyx because it changed.
      [1/1] Cythonizing pkcs11/_pkcs11.pyx
      warning: pkcs11/_pkcs11.pyx:17:0: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
      warning: pkcs11/_errors.pyx:85:44: The keyword 'nogil' should appear at the end of the function signature line. Placing it before 'except' or 'noexcept' will be disallowed in a future version of Cython.
      warning: pkcs11/_pkcs11.pyx:1366:4: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
      warning: pkcs11/_pkcs11.pyx:1390:8: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
      warning: pkcs11/_pkcs11.pyx:1421:8: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
      warning: pkcs11/_pkcs11.pyx:219:70: Use boundscheck(False) for faster access
      warning: pkcs11/_pkcs11.pyx:590:63: Use boundscheck(False) for faster access
      warning: pkcs11/_pkcs11.pyx:616:51: Use boundscheck(False) for faster access
      warning: pkcs11/_pkcs11.pyx:656:64: Use boundscheck(False) for faster access
      warning: pkcs11/_pkcs11.pyx:903:56: Use boundscheck(False) for faster access
      warning: pkcs11/_pkcs11.pyx:947:74: Use boundscheck(False) for faster access
      warning: pkcs11/_pkcs11.pyx:957:67: Use boundscheck(False) for faster access
      warning: pkcs11/_pkcs11.pyx:994:55: Use boundscheck(False) for faster access
      warning: pkcs11/_pkcs11.pyx:1038:74: Use boundscheck(False) for faster access
      warning: pkcs11/_pkcs11.pyx:1048:67: Use boundscheck(False) for faster access
      warning: pkcs11/_pkcs11.pyx:1084:52: Use boundscheck(False) for faster access
      warning: pkcs11/_pkcs11.pyx:1125:65: Use boundscheck(False) for faster access
      warning: pkcs11/_pkcs11.pyx:1217:59: Use boundscheck(False) for faster access
      warning: pkcs11/_pkcs11.pyx:1478:64: Use boundscheck(False) for faster access
      building 'pkcs11._pkcs11' extension
      creating build/temp.linux-x86_64-3.10
      creating build/temp.linux-x86_64-3.10/pkcs11
      x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/pdf-sign/venv/include -I/usr/include/python3.10 -c pkcs11/_pkcs11.c -o build/temp.linux-x86_64-3.10/pkcs11/_pkcs11.o
      error: command 'x86_64-linux-gnu-gcc' failed: No such file or directory
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> python-pkcs11

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

For uharfbuzz:

/home/pdf-sign$ pip install -r requirements.txt 
Collecting python-pkcs11==0.6.0
  Using cached python-pkcs11-0.6.0.tar.gz (105 kB)
  Preparing metadata (setup.py) ... done
Collecting pyhanko[image-support,opentype,pkcs11,xmp]
  Using cached pyHanko-0.20.0-py3-none-any.whl (407 kB)
Collecting pypdf==3.15.0
  Using cached pypdf-3.15.0-py3-none-any.whl (270 kB)
Requirement already satisfied: asn1crypto in ./venv/lib/python3.10/site-packages (from python-pkcs11==0.6.0->-r requirements.txt (line 2)) (1.5.1)
Requirement already satisfied: cached-property in ./venv/lib/python3.10/site-packages (from python-pkcs11==0.6.0->-r requirements.txt (line 2)) (1.5.2)
Collecting cryptography>=3.3.1
  Using cached cryptography-41.0.3-cp37-abi3-manylinux_2_28_x86_64.whl (4.3 MB)
Collecting click>=7.1.2
  Using cached click-8.1.6-py3-none-any.whl (97 kB)
Collecting requests>=2.24.0
  Using cached requests-2.31.0-py3-none-any.whl (62 kB)
Requirement already satisfied: pyyaml>=5.3.1 in ./venv/lib/python3.10/site-packages (from pyhanko[image-support,opentype,pkcs11,xmp]->-r requirements.txt (line 3)) (6.0.1)
Requirement already satisfied: tzlocal>=4.3 in ./venv/lib/python3.10/site-packages (from pyhanko[image-support,opentype,pkcs11,xmp]->-r requirements.txt (line 3)) (5.0.1)
Requirement already satisfied: qrcode>=6.1 in ./venv/lib/python3.10/site-packages (from pyhanko[image-support,opentype,pkcs11,xmp]->-r requirements.txt (line 3)) (7.4.2)
Collecting pyhanko-certvalidator==0.23.*
  Using cached pyhanko_certvalidator-0.23.0-py3-none-any.whl (106 kB)
Collecting pyhanko[image-support,opentype,pkcs11,xmp]
  Using cached pyHanko-0.19.0-py3-none-any.whl (407 kB)
  Using cached pyHanko-0.18.1-py3-none-any.whl (402 kB)
Collecting pyhanko-certvalidator==0.22.*
  Using cached pyhanko_certvalidator-0.22.0-py3-none-any.whl (106 kB)
Collecting pyhanko[image-support,opentype,pkcs11,xmp]
  Using cached pyHanko-0.18.0-py3-none-any.whl (402 kB)
Requirement already satisfied: pytz>=2020.1 in ./venv/lib/python3.10/site-packages (from pyhanko[image-support,opentype,pkcs11,xmp]->-r requirements.txt (line 3)) (2023.3)
  Using cached pyHanko-0.17.2-py3-none-any.whl (379 kB)
Collecting pyhanko-certvalidator==0.20.*
  Using cached pyhanko_certvalidator-0.20.1-py3-none-any.whl (106 kB)
Collecting pyhanko[image-support,opentype,pkcs11,xmp]
  Using cached pyHanko-0.17.1-py3-none-any.whl (378 kB)
  Using cached pyHanko-0.17.0-py3-none-any.whl (378 kB)
  Using cached pyHanko-0.16.0-py3-none-any.whl (361 kB)
Collecting pyhanko-certvalidator~=0.19.8
  Using cached pyhanko_certvalidator-0.19.8-py3-none-any.whl (71 kB)
Collecting pyhanko[image-support,opentype,pkcs11,xmp]
  Using cached pyHanko-0.15.1-py3-none-any.whl (357 kB)
  Using cached pyHanko-0.15.0-py3-none-any.whl (357 kB)
  Using cached pyHanko-0.14.0-py3-none-any.whl (355 kB)
  Using cached pyHanko-0.13.2-py3-none-any.whl (331 kB)
WARNING: pyhanko 0.13.2 does not provide the extra 'xmp'
  Using cached pyHanko-0.13.1-py3-none-any.whl (330 kB)
WARNING: pyhanko 0.13.1 does not provide the extra 'xmp'
  Using cached pyHanko-0.13.0-py3-none-any.whl (330 kB)
WARNING: pyhanko 0.13.0 does not provide the extra 'xmp'
  Using cached pyHanko-0.12.1-py3-none-any.whl (318 kB)
WARNING: pyhanko 0.12.1 does not provide the extra 'xmp'
  Using cached pyHanko-0.12.0-py3-none-any.whl (318 kB)
WARNING: pyhanko 0.12.0 does not provide the extra 'xmp'
  Using cached pyHanko-0.11.0-py3-none-any.whl (312 kB)
WARNING: pyhanko 0.11.0 does not provide the extra 'xmp'
  Using cached pyHanko-0.10.0-py3-none-any.whl (288 kB)
WARNING: pyhanko 0.10.0 does not provide the extra 'xmp'
Collecting pyhanko-certvalidator~=0.18.0
  Using cached pyhanko_certvalidator-0.18.1-py3-none-any.whl (64 kB)
Collecting pyhanko[image-support,opentype,pkcs11,xmp]
  Using cached pyHanko-0.9.0-py3-none-any.whl (313 kB)
WARNING: pyhanko 0.9.0 does not provide the extra 'xmp'
Collecting pyhanko-certvalidator~=0.17.3
  Using cached pyhanko_certvalidator-0.17.4-py3-none-any.whl (65 kB)
Collecting pyhanko[image-support,opentype,pkcs11,xmp]
  Using cached pyHanko-0.8.0-py3-none-any.whl (294 kB)
WARNING: pyhanko 0.8.0 does not provide the extra 'xmp'
Collecting pyhanko-certvalidator~=0.16.0
  Using cached pyhanko_certvalidator-0.16.0-py3-none-any.whl (44 kB)
Collecting Pillow>=7.2.0
  Using cached Pillow-10.0.0-cp310-cp310-manylinux_2_28_x86_64.whl (3.4 MB)
Requirement already satisfied: python-barcode>=0.13.1 in ./venv/lib/python3.10/site-packages (from pyhanko[image-support,opentype,pkcs11,xmp]->-r requirements.txt (line 3)) (0.15.1)
Collecting fonttools>=4.13.0
  Using cached fonttools-4.42.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB)
Collecting uharfbuzz==0.16.1
  Using cached uharfbuzz-0.16.1.zip (1.1 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [190 lines of output]
      warning: src/uharfbuzz/_harfbuzz.pyx:675:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          def guess_segment_properties(self) -> None:
              hb_buffer_guess_segment_properties(self._hb_buffer)

          def set_message_func(self, callback) -> None:
              self._message_callback = callback
              hb_buffer_set_message_func(self._hb_buffer, msgcallback, <void*>callback, NULL)
                                                          ^
      ------------------------------------------------------------

      src/uharfbuzz/_harfbuzz.pyx:269:52: Cannot assign type 'int (hb_buffer_t *, hb_font_t *, const char *, void *) except? -1' to 'hb_buffer_message_func_t'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                    object  # user_data
                                ], bytes],
                                user_data: object):
              cdef Face inst = cls(None)
              inst._hb_face = hb_face_create_for_tables(
                  _reference_table_func, <void*>user_data, NULL)
                  ^
      ------------------------------------------------------------

      src/uharfbuzz/_harfbuzz.pyx:328:12: Cannot assign type 'hb_blob_t *(hb_face_t *, hb_tag_t, void *) except *' to 'hb_reference_table_func_t'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                           int,  # gid
                                           object,  # user_data
                                       ], int],  # h_advance
                                       user_data: object) -> None:
              hb_font_funcs_set_glyph_h_advance_func(
                  self._hb_ffuncs, _glyph_h_advance_func, <void*>user_data, NULL)
                                   ^
      ------------------------------------------------------------

      src/uharfbuzz/_harfbuzz.pyx:574:29: Cannot assign type 'hb_position_t (hb_font_t *, void *, hb_codepoint_t, void *) except? -1' to 'hb_font_get_glyph_h_advance_func_t'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                           int,  # gid
                                           object,  # user_data
                                       ], int],  # v_advance
                                       user_data: object) -> None:
              hb_font_funcs_set_glyph_v_advance_func(
                  self._hb_ffuncs, _glyph_v_advance_func, <void*>user_data, NULL)
                                   ^
      ------------------------------------------------------------

      src/uharfbuzz/_harfbuzz.pyx:585:29: Cannot assign type 'hb_position_t (hb_font_t *, void *, hb_codepoint_t, void *) except? -1' to 'hb_font_get_glyph_v_advance_func_t'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                          int,  # gid
                                          object,  # user_data
                                      ], (int, int, int)],  # success, v_origin_x, v_origin_y
                                      user_data: object) -> None:
              hb_font_funcs_set_glyph_v_origin_func(
                  self._hb_ffuncs, _glyph_v_origin_func, <void*>user_data, NULL)
                                   ^
      ------------------------------------------------------------

      src/uharfbuzz/_harfbuzz.pyx:596:29: Cannot assign type 'hb_bool_t (hb_font_t *, void *, hb_codepoint_t, hb_position_t *, hb_position_t *, void *) except? -1' to 'hb_font_get_glyph_v_origin_func_t'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                      int,  # gid
                                      object,  # user_data
                                  ], str],  # name
                                  user_data: object) -> None:
              hb_font_funcs_set_glyph_name_func(
                  self._hb_ffuncs, _glyph_name_func, <void*>user_data, NULL)
                                   ^
      ------------------------------------------------------------

      src/uharfbuzz/_harfbuzz.pyx:607:29: Cannot assign type 'hb_bool_t (hb_font_t *, void *, hb_codepoint_t, char *, unsigned int, void *) except? -1' to 'hb_font_get_glyph_name_func_t'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                         int,  # unicode
                                         object,  # user_data
                                     ], int],  # gid
                                     user_data: object) -> None:
              hb_font_funcs_set_nominal_glyph_func(
                  self._hb_ffuncs, _nominal_glyph_func, <void*>user_data, NULL)
                                   ^
      ------------------------------------------------------------

      src/uharfbuzz/_harfbuzz.pyx:618:29: Cannot assign type 'hb_bool_t (hb_font_t *, void *, hb_codepoint_t, hb_codepoint_t *, void *) except? -1' to 'hb_font_get_nominal_glyph_func_t'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                           int,
                                           object,  # user_data
                                       ], None]) -> None:
              self._move_to_func = func
              hb_draw_funcs_set_move_to_func(
                  self._hb_drawfuncs, _move_to_func)
                                      ^
      ------------------------------------------------------------

      src/uharfbuzz/_harfbuzz.pyx:874:32: Cannot assign type 'void (hb_position_t, hb_position_t, void *) except *' to 'hb_draw_move_to_func_t'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                   int,
                                   object,  # user_data
                               ], None]) -> None:
              self._line_to_func = func
              hb_draw_funcs_set_line_to_func(
                  self._hb_drawfuncs, _line_to_func)
                                      ^
      ------------------------------------------------------------

      src/uharfbuzz/_harfbuzz.pyx:884:32: Cannot assign type 'void (hb_position_t, hb_position_t, void *) except *' to 'hb_draw_line_to_func_t'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                   int,
                                   object,  # user_data
                                ], None]) -> None:
              self._cubic_to_func = func
              hb_draw_funcs_set_cubic_to_func(
                  self._hb_drawfuncs, _cubic_to_func)
                                      ^
      ------------------------------------------------------------

      src/uharfbuzz/_harfbuzz.pyx:898:32: Cannot assign type 'void (hb_position_t, hb_position_t, hb_position_t, hb_position_t, hb_position_t, hb_position_t, void *) except *' to 'hb_draw_cubic_to_func_t'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                       int,
                                       object,  # user_data
                                   ], None]) -> None:
              self._quadratic_to_func = func
              hb_draw_funcs_set_quadratic_to_func(
                  self._hb_drawfuncs, _quadratic_to_func)
                                      ^
      ------------------------------------------------------------

      src/uharfbuzz/_harfbuzz.pyx:910:32: Cannot assign type 'void (hb_position_t, hb_position_t, hb_position_t, hb_position_t, void *) except *' to 'hb_draw_quadratic_to_func_t'

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                  func: Callable[[
                                      object
                                  ], None]) -> None:
              self._close_path_func = func
              hb_draw_funcs_set_close_path_func(
                  self._hb_drawfuncs, _close_path_func)
                                      ^
      ------------------------------------------------------------

      src/uharfbuzz/_harfbuzz.pyx:918:32: Cannot assign type 'void (void *) except *' to 'hb_draw_close_path_func_t'
      Compiling src/uharfbuzz/_harfbuzz.pyx because it changed.
      [1/1] Cythonizing src/uharfbuzz/_harfbuzz.pyx
      Traceback (most recent call last):
        File "/home/pdf-sign/venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
          main()
        File "/home/pdf-sign/venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/home/pdf-sign/venv/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-g7_8jjq9/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-g7_8jjq9/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-g7_8jjq9/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 55, in <module>
        File "/tmp/pip-build-env-g7_8jjq9/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
          cythonize_one(*args)
        File "/tmp/pip-build-env-g7_8jjq9/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: src/uharfbuzz/_harfbuzz.pyx
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Environment:

MatthiasValvekens commented 1 year ago

Hi,

Please open issues with uharfbuzz/python-pkcs11 respectively. The latest pyHanko version allows the most recent version (at the time I write this), so this needs an upstream fix; not much I can do about that... Dependabot will ensure the dependencies of pyHanko are kept up to date if/when such fixes are made available.

janprzychodniak commented 1 year ago

...I'm actually quite confused now. I came back here to mention that I'm able to install both python-pkcs11 and uharfbuzz with pip without issues. It was only crashing when I was attempting to install them with pyhanko.

But now it also started working with pyhanko... I guess it was a pip issue.

MatthiasValvekens commented 1 year ago

On closer inspection, the issue is probably related to the fact that you forced the pkcs11 version to 0.6.0 (=outdated) in your requirements file. This caused pip to fall back to older pyhanko/uharfbuzz builds as well, and those probably don't build on WSL.