英文:
How can I fix the 'Error in PyMuPDF' when installing paddleocr with pip?
问题
在执行pip install paddleocr
时,我遇到了在构建PyMuPDF的wheel时出现错误的问题。
错误信息如下:
构建PyMuPDF收集的包的wheel时出错:PyMuPDF
构建PyMuPDF (setup.py)的wheel时出错... 错误
错误:子进程以错误退出
× python setup.py bdist_wheel未成功运行。
│ 退出代码:1
╰─> [70行输出]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users51\AppData\Local\Temp\pip-install-ip72hta1\pymupdf_f7a2c6bc313a492fa6c66ad0817a4616\setup.py", line 487, in <module>
mupdf_local = get_mupdf()
^^^^^^^^^^^
File "C:\Users51\AppData\Local\Temp\pip-install-ip72hta1\pymupdf_f7a2c6bc313a492fa6c66ad0817a4616\setup.py", line 450, in get_mupdf
return tar_extract( mupdf_tgz, exists='return')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users51\AppData\Local\Temp\pip-install-ip72hta1\pymupdf_f7a2c6bc313a492fa6c66ad0817a4616\setup.py", line 183, in tar_extract
t.extractall()
File "C:\Users51\AppData\Local\Programs\Python\Python311\Lib\tarfile.py", line 2059, in extractall
self.extract(tarinfo, path, set_attrs=not tarinfo.isdir(),
File "C:\Users51\AppData\Local\Programs\Python\Python311\Lib\tarfile.py", line 2100, in extract
self._extract_member(tarinfo, os.path.join(path, tarinfo.name),
File "C:\Users51\AppData\Local\Programs\Python\Python311\Lib\tarfile.py", line 2173, in _extract_member
self.makefile(tarinfo, targetpath)
File "C:\Users51\AppData\Local\Programs\Python\Python311\Lib\tarfile.py", line 2214, 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-devanagari/utrrs/codepoint/IndicFontFeatureCodepoint-AdditionalConsonants.txt'
[output结束]
注意:此错误源自子进程,可能与pip无关。
ERROR: Failed building wheel for PyMuPDF
Running setup.py clean for PyMuPDF
Failed to build PyMuPDF
ERROR: Could not build wheels for PyMuPDF, which is required to install pyproject.toml-based projects
我尝试了使用pip install wheel
和使用pip install PyMuPDF
来安装PyMuPDF,然后再使用pip install paddleocr
来安装paddleocr,但是同样的问题仍然存在,即无法构建PyMuPDF的wheel文件。
我使用的是intel i3
处理器,64位版本,Python版本是3.11.3
。
英文:
When doing pip install paddleocr
, I am facing an error in building wheel for PyMuPDF.
Building wheels for collected packages: PyMuPDF
Building wheel for PyMuPDF (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [70 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users51\AppData\Local\Temp\pip-install-ip72hta1\pymupdf_f7a2c6bc313a492fa6c66ad0817a4616\setup.py", line 487, in <module>
mupdf_local = get_mupdf()
^^^^^^^^^^^
File "C:\Users51\AppData\Local\Temp\pip-install-ip72hta1\pymupdf_f7a2c6bc313a492fa6c66ad0817a4616\setup.py", line 450, in get_mupdf
return tar_extract( mupdf_tgz, exists='return')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users51\AppData\Local\Temp\pip-install-ip72hta1\pymupdf_f7a2c6bc313a492fa6c66ad0817a4616\setup.py", line 183, in tar_extract
t.extractall()
File "C:\Users51\AppData\Local\Programs\Python\Python311\Lib\tarfile.py", line 2059, in extractall
self.extract(tarinfo, path, set_attrs=not tarinfo.isdir(),
File "C:\Users51\AppData\Local\Programs\Python\Python311\Lib\tarfile.py", line 2100, in extract
self._extract_member(tarinfo, os.path.join(path, tarinfo.name),
File "C:\Users51\AppData\Local\Programs\Python\Python311\Lib\tarfile.py", line 2173, in _extract_member
self.makefile(tarinfo, targetpath)
File "C:\Users51\AppData\Local\Programs\Python\Python311\Lib\tarfile.py", line 2214, 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-devanagari\\utrrs\\codepoint\\IndicFontFeatureCodepoint-AdditionalConsonants.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
Running setup.py clean for PyMuPDF
Failed to build PyMuPDF
ERROR: Could not build wheels for PyMuPDF, which is required to install pyproject.toml-based projects
I tried doing pip install wheel
and installing the PyMuPDF using pip by pip install PyMuPDF
then install paddleocr by pip install paddleocr
but the same problem is there error building wheel file for PyMuPDF.
I am using a intel i3, 64
bit processor
and python version is 3.11.3
答案1
得分: 3
paddleocr
对PyMuPDF<1.21.0
的要求,而PyMuPDF==1.20.2
(符合paddleocr要求的最新版本)只有适用于Python 3.10的whl文件。因此,pip
会尝试从源代码安装。
出现错误的确切消息来自于PyMuPDF
安装脚本,它在尝试下载其依赖项之一时失败,这在提取.tar.gz
文件时发生。现在有不同的选择:
-
手动下载 https://mupdf.com/downloads/archive/mupdf-1.20.3-source.tar.gz ,然后将存档提取到您选择的路径。将环境变量
PYMUPDF_SETUP_MUPDF_BUILD
设置为提取的mupdf-1.20.3
文件夹的路径,然后尝试运行pip install PyMuPDF==1.20.2
。请注意,这种方法还需要一个可用的编译器。 -
下载这个非官方的whl文件:https://drive.google.com/drive/folders/1PESjDkovpvnrWFTKji4-qgT3rcVz-o-F?usp=sharing ,然后使用
pip install <whl文件的路径>
进行安装。
英文:
paddleocr
has the requirement PyMuPDF<1.21.0
and PyMuPDF==1.20.2
(the latest version that fits the paddleocr requirement) only has whl files up to python 3.10. Therefor, pip
falls back to trying to install from source.
The exact error message is from the install script of PyMuPDF
trying to download one of its dependencies, which fails during extraction of the .tar.gz
file. You have different options now:
-
Manually download https://mupdf.com/downloads/archive/mupdf-1.20.3-source.tar.gz then extract the archive to a path of your choosing. Set the environment variable
PYMUPDF_SETUP_MUPDF_BUILD
to the path of the extractedmupdf-1.20.3
folder and try to runpip install PyMuPDF==1.20.2
. Note that you will also need a working compiler for this approach -
Download this unofficial whl file: https://drive.google.com/drive/folders/1PESjDkovpvnrWFTKji4-qgT3rcVz-o-F?usp=sharing and install it with
pip install <path to the whl file>
答案2
得分: 3
尝试这个
pip install "paddleocr>=2.0.1" --upgrade PyMuPDF==1.21.1
对我有效。
英文:
Try this one
pip install "paddleocr>=2.0.1" --upgrade PyMuPDF==1.21.1
it works for me.
答案3
得分: 0
对于在 macOS 上遇到此问题的开发者,您需要安装 pip install PyMuPDF==1.20.0
,因为 PaddleOCR 需要 PyMuPDF<1.21.0
。
如果您仍然遇到 ERROR: Failed building wheel for PyMuPDF
问题,请首先尝试 brew install swig
,然后再尝试 pip install PyMuPDF==1.20.0
,它将起作用。
英文:
For the developers who are facing this issue on macOS, you need to install pip install PyMuPDF==1.20.0
as PaddleOCR requires PyMuPDF<1.21.0
.
If you are still facing the ERROR: Failed building wheel for PyMuPDF
issue then try brew install swig
first and then try pip install PyMuPDF==1.20.0
and it will work.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论