vb64 / markdown-pdf

Markdown to pdf renderer
MIT License
22 stars 2 forks source link

Problems with python3.12 #18

Closed tibeer closed 2 months ago

tibeer commented 2 months ago

Hi! I recently upgraded to python3.12 and tried to install markdown-pdf the usual way with pip (I'm on MacOS by the way).

Unfortunately the installation is stuck for quite some time on this step:

user@device ~ % pip3 install markdown-pdf
Collecting markdown-pdf
  Using cached markdown_pdf-1.1-py3-none-any.whl.metadata (3.3 kB)
Collecting PyMuPDF==1.23.3 (from markdown-pdf)
  Using cached PyMuPDF-1.23.3.tar.gz (60.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... \

after 5min or so the installation fails with a huge error log that exceeds my console. The last few files look like this:

                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/opt/homebrew/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/3k/4k2883bs10n32h6f0ybvcmt80000gp/T/pip-install-jrpjs54o/pymupdf_b8db2ebb1db84de899638ee47b15d7ee/pipcl.py", line 580, in build_wheel
          items = self._call_fn_build(config_settings)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/3k/4k2883bs10n32h6f0ybvcmt80000gp/T/pip-install-jrpjs54o/pymupdf_b8db2ebb1db84de899638ee47b15d7ee/pipcl.py", line 732, in _call_fn_build
          ret = self.fn_build()
                ^^^^^^^^^^^^^^^
        File "/private/var/folders/3k/4k2883bs10n32h6f0ybvcmt80000gp/T/pip-install-jrpjs54o/pymupdf_b8db2ebb1db84de899638ee47b15d7ee/setup.py", line 692, in build
          mupdf_build_dir = build_mupdf_unix( mupdf_local, env_extra, build_type)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/3k/4k2883bs10n32h6f0ybvcmt80000gp/T/pip-install-jrpjs54o/pymupdf_b8db2ebb1db84de899638ee47b15d7ee/setup.py", line 928, in build_mupdf_unix
          subprocess.run( command, shell=True, check=True)
        File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 571, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command 'cd /private/var/folders/3k/4k2883bs10n32h6f0ybvcmt80000gp/T/pip-install-jrpjs54o/pymupdf_b8db2ebb1db84de899638ee47b15d7ee/mupdf-1.23.2-source && XCFLAGS=-DTOFU_CJK_EXT /opt/homebrew/Cellar/python@3.12/3.12.3/bin/python3.12 ./scripts/mupdfwrap.py -d build/PyMuPDF-arm64-shared-tesseract-release -b all && echo /private/var/folders/3k/4k2883bs10n32h6f0ybvcmt80000gp/T/pip-install-jrpjs54o/pymupdf_b8db2ebb1db84de899638ee47b15d7ee/mupdf-1.23.2-source/build/PyMuPDF-arm64-shared-tesseract-release: && ls -l /private/var/folders/3k/4k2883bs10n32h6f0ybvcmt80000gp/T/pip-install-jrpjs54o/pymupdf_b8db2ebb1db84de899638ee47b15d7ee/mupdf-1.23.2-source/build/PyMuPDF-arm64-shared-tesseract-release' returned non-zero exit status 1.
      [end of output]

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

× Encountered error while generating package metadata.
╰─> See above for output.

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

The problem does not occur when using other pip packages. I'm happy to provide more logs if needed :)

vb64 commented 2 months ago

Seems like problem with PyMuPDF with Python 3.12 at MacOS.

I updated the PyMuPDF link from 1.23.3 to 1.24.2 (latest) and roll out new release 1.2 of markdown-pdf.

I can't verify the installation under MacOS. Try it for yourself with version of markdown-pdf 1.2. If the installation error does not disappear, then ask the PyMuPDF developers.

tibeer commented 2 months ago

Awesome! That solved the problem. Thank you so much!