如何在 Heroku Django 上安装 PyMuPDF

How to Install PyMuPDF on Heroku Django

我正在尝试制作一个从 PDF 中提取图像的脚本,我在 Django 项目中制作了一个脚本并将 pymupdf 添加到 requirements.txt.I 有一个带有 Mupdf 的 Aptfile 和 https://github.com/heroku/heroku-buildpack-apt作为 buildpack 和 heroku/python。在尝试将 master 推送到 Heroku 时,推送失败,这是错误。

    Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 322 bytes | 322.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Apt app detected
remote: -----> Detected Aptfile or Stack changes, flushing cache
remote: -----> Adding custom repositories
remote: -----> Updating apt caches
remote:        Get:1 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
remote:        Get:2 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease [46.3 kB]
remote:        Get:3 http://archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
remote:        Get:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
remote:        Get:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
remote:        Get:6 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/11 amd64 Packages [2,483 B]
remote:        Get:7 http://apt.postgresql.org/pub/repos/apt bionic-pgdg/main amd64 Packages [294 kB]
remote:        Get:8 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1,344 kB]
remote:        Get:9 http://archive.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [817 kB]
remote:        Get:10 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 Packages [812 kB]
remote:        Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [1,101 kB]
remote:        Get:12 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1,343 kB]
remote:        Fetched 17.5 MB in 3s (5,813 kB/s)
remote:        Reading package lists...
remote: -----> Fetching .debs for mupdf
remote:        Reading package lists...
remote:        Building dependency tree...
remote:        The following additional packages will be installed:
remote:          libopenjp2-7
remote:        Suggested packages:
remote:          mupdf-tools
remote:        The following NEW packages will be installed:
remote:          libopenjp2-7 mupdf
remote:        0 upgraded, 2 newly installed, 0 to remove and 46 not upgraded.
remote:        Need to get 19.2 MB of archives.
remote:        After this operation, 35.3 MB of additional disk space will be used.
remote:        Get:1 http://archive.ubuntu.com/ubuntu bionic-security/universe amd64 libopenjp2-7 amd64 2.3.0-2build0.18.04.1 [145 kB]
remote:        Get:2 http://archive.ubuntu.com/ubuntu bionic/universe amd64 mupdf amd64 1.12.0+ds1-1 [19.0 MB]
remote:        Fetched 19.2 MB in 1s (13.5 MB/s)
remote:        Download complete and in download only mode
remote: -----> Installing libopenjp2-7_2.3.0-2build0.18.04.1_amd64.deb
remote: -----> Installing mupdf_1.12.0+ds1-1_amd64.deb
remote: -----> Writing profile script
remote: -----> Rewrite package-config files
remote: -----> Python app detected
remote: -----> Need to update SQLite3, clearing cache
remote: -----> Installing python-3.6.10
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: Sqlite3 successfully installed.
remote: -----> Installing requirements with pip
remote:        Collecting bs4==0.0.1 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 1))
remote:          Downloading https://files.pythonhosted.org/packages/10/ed/7e8b97591f6f456174139ec089c769f89a94a1a4025fe967691de971f314/bs4-0.0.1.tar.gz
remote:        Collecting Django==2.1.11 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 2))
remote:          Downloading https://files.pythonhosted.org/packages/8c/49/d5038239995594281478bf209f8d93524ad342d500009a697b27f884668a/Django-2.1.11-py3-none-any.whl (7.3MB)
remote:        Collecting django-heroku==0.3.1 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 3))
remote:          Downloading https://files.pythonhosted.org/packages/59/af/5475a876c5addd5a3494db47d9f7be93cc14d3a7603542b194572791b6c6/django_heroku-0.3.1-py2.py3-none-any.whl
remote:        Collecting django-widget-tweaks==1.4.5 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 4))
remote:          Downloading https://files.pythonhosted.org/packages/1c/11/a8d3a4d73a09973d62ce381fb73a926707cb1485aa29599f2afc04dee7b4/django_widget_tweaks-1.4.5-py2.py3-none-any.whl
remote:        Collecting forex-python==1.5 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 5))
remote:          Downloading https://files.pythonhosted.org/packages/1a/ff/f3f6da21e8fdc6ece355643871749c79a3191fed1cba088cbd0dc597dfee/forex-python-1.5.tar.gz
remote:        Collecting gunicorn==19.9.0 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 6))
remote:          Downloading https://files.pythonhosted.org/packages/8c/da/b8dd8deb741bff556db53902d4706774c8e1e67265f69528c14c003644e6/gunicorn-19.9.0-py2.py3-none-any.whl (112kB)
remote:        Collecting imageio==2.6.1 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 7))
remote:          Downloading https://files.pythonhosted.org/packages/1a/de/f7f985018f462ceeffada7f6e609919fbcc934acd9301929cba14bc2c24a/imageio-2.6.1-py3-none-any.whl (3.3MB)
remote:        Collecting img2pdf==0.3.3 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 8))
remote:          Downloading https://files.pythonhosted.org/packages/e0/c6/7cd14232a1b10bf884c12daf3626afb76c4f60b52ae0eb23ce1519542ae4/img2pdf-0.3.3.tar.gz (80kB)
remote:        Collecting imutils==0.5.3 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 9))
remote:          Downloading https://files.pythonhosted.org/packages/b5/94/46dcae8c061e28be31bcaa55c560cb30ee9403c9a4bb2659768ec1b9eb7d/imutils-0.5.3.tar.gz
remote:        Collecting opencv-python-headless==4.1.2.30 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 10))
remote:          Downloading https://files.pythonhosted.org/packages/5d/96/b2824df85d8c5f148125e4fee073a62fde17639502fe67042b212ebfe488/opencv_python_headless-4.1.2.30-cp36-cp36m-manylinux1_x86_64.whl (21.8MB)
remote:        Collecting pandas==0.25.3 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 11))
remote:          Downloading https://files.pythonhosted.org/packages/52/3f/f6a428599e0d4497e1595030965b5ba455fd8ade6e977e3c819973c4b41d/pandas-0.25.3-cp36-cp36m-manylinux1_x86_64.whl (10.4MB)
remote:        Collecting Pillow==6.1.0 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 12))
remote:          Downloading https://files.pythonhosted.org/packages/14/41/db6dec65ddbc176a59b89485e8cc136a433ed9c6397b6bfe2cd38412051e/Pillow-6.1.0-cp36-cp36m-manylinux1_x86_64.whl (2.1MB)
remote:        Collecting Pygments==2.4.2 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 13))
remote:          Downloading https://files.pythonhosted.org/packages/5c/73/1dfa428150e3ccb0fa3e68db406e5be48698f2a979ccbcec795f28f44048/Pygments-2.4.2-py2.py3-none-any.whl (883kB)
remote:        Collecting pypandoc==1.4 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 14))
remote:          Downloading https://files.pythonhosted.org/packages/71/81/00184643e5a10a456b4118fc12c96780823adb8ed974eb2289f29703b29b/pypandoc-1.4.tar.gz
remote:        Collecting PyPDF2==1.26.0 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 15))
remote:          Downloading https://files.pythonhosted.org/packages/b4/01/68fcc0d43daf4c6bdbc6b33cc3f77bda531c86b174cac56ef0ffdb96faab/PyPDF2-1.26.0.tar.gz (77kB)
remote:        Collecting scikit-image==0.16.2 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 16))
remote:          Downloading https://files.pythonhosted.org/packages/c8/bb/771800366f41d66eef51e4b80515f8ef7edab234a3f244fdce3bafe89b39/scikit_image-0.16.2-cp36-cp36m-manylinux1_x86_64.whl (26.5MB)
remote:        Collecting whitenoise==5.0.1 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 17))
remote:          Downloading https://files.pythonhosted.org/packages/ae/25/0c8f08c9d3c93192cd286594f1e87b17bab496fb9082c2a69e17051b91fd/whitenoise-5.0.1-py2.py3-none-any.whl
remote:        Collecting xlrd==1.2.0 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 18))
remote:          Downloading https://files.pythonhosted.org/packages/b0/16/63576a1a001752e34bf8ea62e367997530dc553b689356b9879339cf45a4/xlrd-1.2.0-py2.py3-none-any.whl (103kB)
remote:        Collecting zipp==0.6.0 (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 19))
remote:          Downloading https://files.pythonhosted.org/packages/74/3d/1ee25a26411ba0401b43c6376d2316a71addcc72ef8690b101b4ea56d76a/zipp-0.6.0-py2.py3-none-any.whl
remote:        Collecting python-docx (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 20))
remote:          Downloading https://files.pythonhosted.org/packages/e4/83/c66a1934ed5ed8ab1dbb9931f1779079f8bca0f6bbc5793c06c4b5e7d671/python-docx-0.8.10.tar.gz (5.5MB)
remote:        Collecting pymupdf (from -r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 21))
remote:          Downloading https://files.pythonhosted.org/packages/3d/6a/5b4d4f1964a0802f8f2514fcd1f8d53c7f1e74a55765f99df1cf482bbbe8/PyMuPDF-1.16.10.tar.gz (175kB)
remote:        Collecting beautifulsoup4 (from bs4==0.0.1->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 1))
remote:          Downloading https://files.pythonhosted.org/packages/cb/a1/c698cf319e9cfed6b17376281bd0efc6bfc8465698f54170ef60a485ab5d/beautifulsoup4-4.8.2-py3-none-any.whl (106kB)
remote:        Collecting pytz (from Django==2.1.11->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 2))
remote:          Downloading https://files.pythonhosted.org/packages/e7/f9/f0b53f88060247251bf481fa6ea62cd0d25bf1b11a87888e53ce5b7c8ad2/pytz-2019.3-py2.py3-none-any.whl (509kB)
remote:        Collecting dj-database-url>=0.5.0 (from django-heroku==0.3.1->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 3))
remote:          Downloading https://files.pythonhosted.org/packages/d4/a6/4b8578c1848690d0c307c7c0596af2077536c9ef2a04d42b00fabaa7e49d/dj_database_url-0.5.0-py2.py3-none-any.whl
remote:        Collecting psycopg2 (from django-heroku==0.3.1->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 3))
remote:          Downloading https://files.pythonhosted.org/packages/84/d7/6a93c99b5ba4d4d22daa3928b983cec66df4536ca50b22ce5dcac65e4e71/psycopg2-2.8.4.tar.gz (377kB)
remote:        Collecting requests (from forex-python==1.5->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 5))
remote:          Downloading https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl (57kB)
remote:        Collecting simplejson (from forex-python==1.5->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 5))
remote:          Downloading https://files.pythonhosted.org/packages/98/87/a7b98aa9256c8843f92878966dc3d8d914c14aad97e2c5ce4798d5743e07/simplejson-3.17.0.tar.gz (83kB)
remote:        Collecting numpy (from imageio==2.6.1->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 7))
remote:          Downloading https://files.pythonhosted.org/packages/62/20/4d43e141b5bc426ba38274933ef8e76e85c7adea2c321ecf9ebf7421cedf/numpy-1.18.1-cp36-cp36m-manylinux1_x86_64.whl (20.1MB)
remote:        Collecting python-dateutil>=2.6.1 (from pandas==0.25.3->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 11))
remote:          Downloading https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227kB)
remote:        Collecting matplotlib!=3.0.0,>=2.0.0 (from scikit-image==0.16.2->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 16))
remote:          Downloading https://files.pythonhosted.org/packages/7e/07/4b361d6d0f4e08942575f83a11d33f36897e1aae4279046606dd1808778a/matplotlib-3.1.3-cp36-cp36m-manylinux1_x86_64.whl (13.1MB)
remote:        Collecting networkx>=2.0 (from scikit-image==0.16.2->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 16))
remote:          Downloading https://files.pythonhosted.org/packages/41/8f/dd6a8e85946def36e4f2c69c84219af0fa5e832b018c970e92f2ad337e45/networkx-2.4-py3-none-any.whl (1.6MB)
remote:        Collecting PyWavelets>=0.4.0 (from scikit-image==0.16.2->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 16))
remote:          Downloading https://files.pythonhosted.org/packages/59/bb/d2b85265ec9fa3c1922210c9393d4cdf7075cc87cce6fe671d7455f80fbc/PyWavelets-1.1.1-cp36-cp36m-manylinux1_x86_64.whl (4.4MB)
remote:        Collecting scipy>=0.19.0 (from scikit-image==0.16.2->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 16))
remote:          Downloading https://files.pythonhosted.org/packages/dc/29/162476fd44203116e7980cfbd9352eef9db37c49445d1fec35509022f6aa/scipy-1.4.1-cp36-cp36m-manylinux1_x86_64.whl (26.1MB)
remote:        Collecting more-itertools (from zipp==0.6.0->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 19))
remote:          Downloading https://files.pythonhosted.org/packages/72/96/4297306cc270eef1e3461da034a3bebe7c84eff052326b130824e98fc3fb/more_itertools-8.2.0-py3-none-any.whl (43kB)
remote:        Collecting lxml>=2.3.2 (from python-docx->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 20))
remote:          Downloading https://files.pythonhosted.org/packages/dd/ba/a0e6866057fc0bbd17192925c1d63a3b85cf522965de9bc02364d08e5b84/lxml-4.5.0-cp36-cp36m-manylinux1_x86_64.whl (5.8MB)
remote:        Collecting soupsieve>=1.2 (from beautifulsoup4->bs4==0.0.1->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 1))
remote:          Downloading https://files.pythonhosted.org/packages/81/94/03c0f04471fc245d08d0a99f7946ac228ca98da4fa75796c507f61e688c2/soupsieve-1.9.5-py2.py3-none-any.whl
remote:        Collecting certifi>=2017.4.17 (from requests->forex-python==1.5->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 5))
remote:          Downloading https://files.pythonhosted.org/packages/b9/63/df50cac98ea0d5b006c55a399c3bf1db9da7b5a24de7890bc9cfd5dd9e99/certifi-2019.11.28-py2.py3-none-any.whl (156kB)
remote:        Collecting chardet<3.1.0,>=3.0.2 (from requests->forex-python==1.5->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 5))
remote:          Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
remote:        Collecting idna<2.9,>=2.5 (from requests->forex-python==1.5->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 5))
remote:          Downloading https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl (58kB)
remote:        Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests->forex-python==1.5->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 5))
remote:          Downloading https://files.pythonhosted.org/packages/e8/74/6e4f91745020f967d09332bb2b8b9b10090957334692eb88ea4afe91b77f/urllib3-1.25.8-py2.py3-none-any.whl (125kB)
remote:        Collecting six>=1.5 (from python-dateutil>=2.6.1->pandas==0.25.3->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 11))
remote:          Downloading https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
remote:        Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.16.2->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 16))
remote:          Downloading https://files.pythonhosted.org/packages/5d/bc/1e58593167fade7b544bfe9502a26dc860940a79ab306e651e7f13be68c2/pyparsing-2.4.6-py2.py3-none-any.whl (67kB)
remote:        Collecting cycler>=0.10 (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.16.2->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 16))
remote:          Downloading https://files.pythonhosted.org/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whl
remote:        Collecting kiwisolver>=1.0.1 (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.16.2->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 16))
remote:          Downloading https://files.pythonhosted.org/packages/f8/a1/5742b56282449b1c0968197f63eae486eca2c35dcd334bab75ad524e0de1/kiwisolver-1.1.0-cp36-cp36m-manylinux1_x86_64.whl (90kB)
remote:        Collecting decorator>=4.3.0 (from networkx>=2.0->scikit-image==0.16.2->-r /tmp/build_460e46d9ff4616a54e3ebd7caa495280/requirements.txt (line 16))
remote:          Downloading https://files.pythonhosted.org/packages/8f/b7/f329cfdc75f3d28d12c65980e4469e2fa373f1953f5df6e370e84ea2e875/decorator-4.4.1-py2.py3-none-any.whl
remote:        Installing collected packages: soupsieve, beautifulsoup4, bs4, pytz, Django, dj-database-url, whitenoise, psycopg2, django-heroku, django-widget-tweaks, certifi, chardet, idna, urllib3, requests, simplejson, forex-python, gunicorn, numpy, Pillow, imageio, img2pdf, imutils, opencv-python-headless, six, python-dateutil, pandas, Pygments, pypandoc, PyPDF2, pyparsing, cycler, kiwisolver, matplotlib, decorator, networkx, PyWavelets, scipy, scikit-image, xlrd, more-itertools, zipp, lxml, python-docx, pymupdf
remote:          Running setup.py install for bs4: started
remote:            Running setup.py install for bs4: finished with status 'done'
remote:          Running setup.py install for psycopg2: started
remote:            Running setup.py install for psycopg2: finished with status 'done'
remote:          Running setup.py install for simplejson: started
remote:            Running setup.py install for simplejson: finished with status 'done'
remote:          Running setup.py install for forex-python: started
remote:            Running setup.py install for forex-python: finished with status 'done'
remote:          Running setup.py install for img2pdf: started
remote:            Running setup.py install for img2pdf: finished with status 'done'
remote:          Running setup.py install for imutils: started
remote:            Running setup.py install for imutils: finished with status 'done'
remote:          Running setup.py install for pypandoc: started
remote:            Running setup.py install for pypandoc: finished with status 'done'
remote:          Running setup.py install for PyPDF2: started
remote:            Running setup.py install for PyPDF2: finished with status 'done'
remote:          Running setup.py install for python-docx: started
remote:            Running setup.py install for python-docx: finished with status 'done'
remote:          Running setup.py install for pymupdf: started
remote:            Running setup.py install for pymupdf: finished with status 'error'
remote:            Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-205xyxft/pymupdf/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-a457z02t-record/install-record.txt --single-version-externally-managed --compile:
remote:            running install
remote:            running build
remote:            running build_py
remote:            creating build
remote:            creating build/lib.linux-x86_64-3.6
remote:            creating build/lib.linux-x86_64-3.6/fitz
remote:            copying fitz/__init__.py -> build/lib.linux-x86_64-3.6/fitz
remote:            copying fitz/fitz.py -> build/lib.linux-x86_64-3.6/fitz
remote:            copying fitz/utils.py -> build/lib.linux-x86_64-3.6/fitz
remote:            copying fitz/__main__.py -> build/lib.linux-x86_64-3.6/fitz
remote:            running build_ext
remote:            building 'fitz._fitz' extension
remote:            creating build/temp.linux-x86_64-3.6
remote:            creating build/temp.linux-x86_64-3.6/fitz
remote:            gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/include/mupdf -I/usr/local/include/mupdf -I/app/.heroku/python/include/python3.6m -c fitz/fitz_wrap.c -o build/temp.linux-x86_64-3.6/fitz/fitz_wrap.o
remote:            fitz/fitz_wrap.c:2732:10: fatal error: fitz.h: No such file or directory
remote:             #include <fitz.h>
remote:                      ^~~~~~~~
remote:            compilation terminated.
remote:            error: command 'gcc' failed with exit status 1
remote:
remote:            ----------------------------------------
remote:        Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-205xyxft/pymupdf/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-a457z02t-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-205xyxft/pymupdf/
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to compare-tool.
remote:
To https://git.heroku.com/compare-tool.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/compare-tool.git'

`

我遇到了与您描述的完全相同的问题。

在此之前,我的 Django Heroku 应用程序使用 PyMuPDF / Fitz 时工作正常,没有任何问题。所以我得出结论,这个构建失败是一个全新的问题,导致了一些变化。

就我而言,我最近刚刚更新了我的依赖项,其中包括 PyMuPDF。

解决我问题的方法是将 PyMuPDF 锁定在 1.16.0 版本。

pymupdf = "==1.16.0"

我认为截至撰写本文时的最新版本是 1.16.1 或 1.16.2。

我不是 100% 确定根本原因,但我怀疑这是因为最新版本的 PyMuPDF 可能不允许向后兼容旧版本的 pip。

在我的 live Heroku dyno 上检查 pip 版本 运行 后,我得到:

"You are using pip version 9.0.2, however version 20.0.2 is available."

如果您使用默认的 Heroku Python 环境,同样适用于您。

如果冻结您的 PyMuPDF 版本也能为您解决问题,请告诉我们!

经过一些调试,我已经解决了这个问题。

问题出在新版本的 PyMuPDF 上,因此,我没有使用最新版本的 PyMuPdf,而是使用了旧版本。

在 Aptfile 中,不添加 Mupdf-tools,而是添加

http://ftp.br.debian.org/debian/pool/main/m/mupdf/mupdf_1.14.0+ds1-4_amd64.deb

requirements.txt 中,不添加 PyMuPDF,而是添加

PyMuPDF==1.14.20

这应该可以解决。