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

ERROR: Could not build wheels for PyMuPDF, which is required to install pyproject.toml-based projects #10669

Closed
typetrade opened this issue Aug 17, 2023 · 13 comments
Assignees
Labels

Comments

@typetrade
Copy link

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

  • 系统环境/System Environment:

  • 设备名称 WIN-JOP2I1VJLU8
    处理器 Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz 3.00 GHz
    机带 RAM 32.0 GB (31.8 GB 可用)
    设备 ID A706649D-5962-4BEB-9754-B86005248F4A
    产品 ID 00454-40000-00001-AA972
    系统类型 64 位操作系统, 基于 x64 的处理器
    笔和触控 没有可用于此显示器的笔或触控输入

  • 版本号/Version:Paddle: PaddleOCR: 问题相关组件/Related components:

  • python -m pip install paddlepaddle==2.5.1 -i https://mirror.baidu.com/pypi/simple

  • 2.5.1

  • 运行指令/Command Code:

  • python -m pip install paddlepaddle==2.5.1 -i https://mirror.baidu.com/pypi/simple

  • cd PaddleOCR

  • python -m pip install -r requirements.txt

  • 完整报错/Complete Error Message:

    PyMuPDF/setup.py: mupdf_tgz already exists: C:\Users\Administrator\AppData\Local\Temp\pip-install-1zdq2qwg\pymupdf_6bd2c8ecd9ba48598b126e1f128726c5\mupdf.tgz
    PyMuPDF/setup.py: Extracting C:\Users\Administrator\AppData\Local\Temp\pip-install-1zdq2qwg\pymupdf_6bd2c8ecd9ba48598b126e1f128726c5\mupdf.tgz
    Traceback (most recent call last):
      File "C:\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
        main()
      File "C:\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel
        return _build_backend().build_wheel(wheel_directory, config_settings,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-qct03m5h\overlay\Lib\site-packages\setuptools\build_meta.py", line 434, in build_wheel
        return self._build_with_temp_dir(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-qct03m5h\overlay\Lib\site-packages\setuptools\build_meta.py", line 419, in _build_with_temp_dir
        self.run_setup()
      File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-qct03m5h\overlay\Lib\site-packages\setuptools\build_meta.py", line 507, in run_setup
        super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
      File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-qct03m5h\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup
        exec(code, locals())
      File "<string>", line 487, in <module>
      File "<string>", line 450, in get_mupdf
      File "<string>", line 183, in tar_extract
      File "C:\Python311\Lib\tarfile.py", line 2257, in extractall
        self._extract_one(tarinfo, path, set_attrs=not tarinfo.isdir(),
      File "C:\Python311\Lib\tarfile.py", line 2324, in _extract_one
        self._handle_fatal_error(e)
      File "C:\Python311\Lib\tarfile.py", line 2320, in _extract_one
        self._extract_member(tarinfo, os.path.join(path, tarinfo.name),
      File "C:\Python311\Lib\tarfile.py", line 2403, in _extract_member
        self.makefile(tarinfo, targetpath)
      File "C:\Python311\Lib\tarfile.py", line 2448, in makefile
        with bltn_open(targetpath, "wb") as target:
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    FileNotFoundError: [Errno 2] No such file or directory: '.\\mupdf-1.20.3-source\\thirdparty\\harfbuzz\\test\\shaping\\texts\\in-house\\shaper-indic\\script-assamese\\utrrs\\codepoint\\IndicFontFeatureCodepoint-AdditionalVowels.txt'
    [end of output]
    

    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for PyMuPDF
    Building wheel for future (pyproject.toml) ... done
    Created wheel for future: filename=future-0.18.3-py3-none-any.whl size=492053 sha256=d49b48f789d7cd29e93c035fdf14bb9f5e69d3ff28a24740c03e38085053b02a
    Stored in directory: c:\users\administrator\appdata\local\pip\cache\wheels\da\19\ca\9d8c44cd311a955509d7e13da3f0bea42400c469ef825b580b
    Successfully built future
    Failed to build PyMuPDF
    ERROR: Could not build wheels for PyMuPDF, which is required to install pyproject.toml-based projects

btw:
注意,windows环境下,建议从这里下载shapely安装包完成安装, 直接通过pip安装的shapely库可能出现[winRrror 126] 找不到指定模块的问题。

微信截图_20230817214648
https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely 报404,下载shapely安装包的链接已经失效。
https://github.com/PaddlePaddle/PaddleOCR/blob/static/doc/doc_ch/installation.md 这个md需要更新下下载链接。

@typetrade
Copy link
Author

PS D:\github\PaddleOCR> python -m pip install --upgrade pymupdf
Collecting pymupdf
Obtaining dependency information for pymupdf from https://files.pythonhosted.org/packages/89/7c/e9d2259ec46547bfe4956fde5c4e42c1421acd20c4bcf2da772b4888bb6f/PyMuPDF-1.22.5-cp311-cp311-win_amd64.whl.metadata
Downloading PyMuPDF-1.22.5-cp311-cp311-win_amd64.whl.metadata (8.5 kB)
Downloading PyMuPDF-1.22.5-cp311-cp311-win_amd64.whl (11.8 MB)
---------------------------------------- 11.8/11.8 MB 1.4 MB/s eta 0:00:00
Installing collected packages: pymupdf
Successfully installed pymupdf-1.22.5

@typetrade
Copy link
Author

安装“Microsoft Visual C++ Build Tools”。
打开 https://visualstudio.microsoft.com/ja/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16

也不行,不知道是不是Python311的问题,是不是需要回退到Python310?

@xu756
Copy link

xu756 commented Aug 17, 2023

iShot_2023-08-18_00 24 04 执行下面试试 `pip install "paddleocr>=2.0.1" --upgrade PyMuPDF==1.21.1`

@typetrade
Copy link
Author

执行
pip install "paddleocr>=2.0.1" --upgrade PyMuPDF==1.21.1
未解决

修改requirements.txt
PyMuPDF==1.19.0

  "D:\Program Files\Microsoft\VisualStudio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I./mupdf/include -I./mupdf/include/mupdf -I./mupdf/thirdparty/freetype/include -IC:\Python311\include -IC:\Python311\Include "-ID:\Program Files\Microsoft\VisualStudio\2022\Enterprise\VC\Tools\MSVC\14.37.32822\include" "-ID:\Program Files\Microsoft\VisualStudio\2022\Enterprise\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /Tcfitz/fitz_wrap.c /Fobuild\temp.win-amd64-cpython-311\Release\fitz/fitz_wrap.obj
  fitz_wrap.c
  fitz/fitz_wrap.c(2755): fatal error C1083: 无法打开包括文件: “fitz.h”: No such file or directory
  error: command 'D:\\Program Files\\Microsoft\\VisualStudio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.37.32822\\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 PyMuPDF
Failed to build PyMuPDF
ERROR: Could not build wheels for PyMuPDF, which is required to install pyproject.toml-based projects

看上去是Path给2022给错了,我换成2019试试。
PaddleOCR在安装这块不够人性化,哎

@typetrade
Copy link
Author

iShot_2023-08-18_00 24 04 执行下面试试 pip install "paddleocr>=2.0.1" --upgrade PyMuPDF==1.21.1

pip install "paddleocr>=2.0.1" --upgrade PyMuPDF==1.21.1
这个单独执行能成功,但是再去执行python -m pip install -r requirements.txt
还是出错
fitz_wrap.c(2755): fatal error C1083: 无法打开包括文件: “fitz.h”: No such file or directory

@zxffffffff
Copy link

遇到了相同的问题,尝试pip install "paddleocr>=2.0.1" --upgrade PyMuPDF==1.21.1,遇到了更多版本依赖报错
:(

@zxffffffff
Copy link

遇到了相同的问题,尝试 pip install "paddleocr>=2.0.1" --upgrade PyMuPDF==1.21.1,遇到了更多版本依赖报错 :(

找到了问题:
对于Windows环境用户:直接通过pip安装的shapely库可能出现[winRrror 126] 找不到指定模块的问题。建议从这里下载shapely安装包完成安装。

:)

@1511878618
Copy link

I think the best solution for this question is to usepython=3.10 or lower version of python

conda create -c ocr python=3.10
python -m pip install paddlepaddle-gpu==2.5.1.post120 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html  # please check this url for your cuda version: https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html
pip install "paddleocr>=2.0.1"

@humorbei
Copy link

humorbei commented Nov 6, 2023

I think the best solution for this question is to usepython=3.10 or lower version of python

conda create -c ocr python=3.10
python -m pip install paddlepaddle-gpu==2.5.1.post120 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html  # please check this url for your cuda version: https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/linux-pip.html
pip install "paddleocr>=2.0.1"

right! same issue with python 3.11, but it's ok when using python 3.9

@FesonX
Copy link

FesonX commented Dec 25, 2023

the README badge SHOULD be
instead of

@FesonX
Copy link

FesonX commented Dec 25, 2023

As the original issue mention in PyMuPDF Discussions #875 , this bugs is resolved in PyMuPDF 1.21.0
I had run this command in Mac M1 Pro machine successfully:
pip install "paddleocr>=2.0.1" --upgrade "PyMuPDF>=1.21.0"

@FesonX
Copy link

FesonX commented Dec 25, 2023

@tink2123 Additional information, due to the dependency conflict, paddleocr 2.7.0.3 depends on PyMuPDF<1.21.0,
the command can only install paddleocr==2.6.0.1

pip install "paddleocr>=2.0.1" --upgrade "PyMuPDF>=1.21.0"

and introduce a new error of numpy 1.20 deprecated alias np.int. which need to downgrade numpy<1.20 (#8892)

The requirements.txt SHOULD set module with specific version to avoid this problem.

OR the docs SHOULD update install docs to:

pip install "paddleocr>=2.7"  -f --upgrade "PyMuPDF>=1.21.0" --no-deps

@jzhang533
Copy link
Collaborator

PyMuPDF is now optional. see: #11685 #11692

@jzhang533 jzhang533 added triaged this issue has been looked, and triaged. software compatibility PR is welcome labels Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants