yl1213926 2024-03-05 13:44 采纳率: 20%
浏览 488
已结题

安装paddleocr错误ModuleNotFoundError: No module named 'patch_ng',安装patch-ng还是报一样的错误

在安装paddleocr出现错误:

PS D:\mysoftware\Python\Scripts\PaddleOCR> pip install paddleocr -i https://mirror.baidu.com/pypi/simple
Looking in indexes: https://mirror.baidu.com/pypi/simple
Collecting paddleocr
  Using cached https://mirror.baidu.com/pypi/packages/8f/d0/1a2f9430f61781beb16556182baa938e8f93c8b46c27ad5865a5655fae05/paddleocr-2.7.0.3-py3-none-any.
whl (465 kB)
Collecting shapely (from paddleocr)
  Using cached https://mirror.baidu.com/pypi/packages/c7/d7/1bf4f48d83af09ce1af06c21752670fa8cdcafa72dbc452b809b215cda2a/shapely-2.0.2-cp312-cp312-win_a
md64.whl (1.4 MB)
Collecting scikit-image (from paddleocr)
  Using cached https://mirror.baidu.com/pypi/packages/dc/35/e6327ae498c6f557cb0a7c3fc284effe7958d2d1c43fb61cd77804fc2c4f/scikit_image-0.22.0-cp312-cp312
-win_amd64.whl (25.0 MB)
Collecting imgaug (from paddleocr)
  Using cached https://mirror.baidu.com/pypi/packages/66/b1/af3142c4a85cba6da9f4ebb5ff4e21e2616309552caca5e8acefe9840622/imgaug-0.4.0-py2.py3-none-any.w
hl (948 kB)
Collecting pyclipper (from paddleocr)
  Using cached https://mirror.baidu.com/pypi/packages/a1/f0/760e614b84dd4d8f03dd5432dda100d699e23074c263b38b6c117adc8395/pyclipper-1.3.0.post5-cp312-cp3
12-win_amd64.whl (108 kB)
Collecting lmdb (from paddleocr)
  Using cached https://mirror.baidu.com/pypi/packages/de/13/dd9b0c1924f0becc93e0bacd123a4e7a347966e3e74753ace3b1e85acc39/lmdb-1.4.1.tar.gz (881 kB)
  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
  ╰─> [27 lines of output]
      py-lmdb: Using bundled liblmdb with py-lmdb patches; override with LMDB_FORCE_SYSTEM=1 or LMDB_PURE=1.
      Traceback (most recent call last):
        File "<string>", line 92, in <module>
      ModuleNotFoundError: No module named 'patch_ng'
     
      During handling of the above exception, another exception occurred:
     
      Traceback (most recent call last):
        File "D:\mysoftware\Python\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "D:\mysoftware\Python\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 "D:\mysoftware\Python\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel 
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\shui\AppData\Local\Temp\pip-build-env-_mus8qbu\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for
_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\shui\AppData\Local\Temp\pip-build-env-_mus8qbu\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requi
res
          self.run_setup()
        File "C:\Users\shui\AppData\Local\Temp\pip-build-env-_mus8qbu\overlay\Lib\site-packages\setuptools\build_meta.py", line 480, in run_setup       
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\shui\AppData\Local\Temp\pip-build-env-_mus8qbu\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup       
          exec(code, locals())
        File "<string>", line 94, in <module>
      Exception: Building py-lmdb from source on Windows requires the "patch-ng" python module.
      [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.

[notice] A new release of pip is available: 23.3.2 -> 24.0
[notice] To update, run: python.exe -m pip install --upgrade pip


安装patch_ng:

PS D:\mysoftware\Python\Scripts> pip install patch_ng
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting patch_ng
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c1/b2/ad3cd464101435fdf642d20e0e5e782b4edaef1affdf2adfc5c75660225b/patch-ng-1.17.4.tar.gz (17 k
B)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: patch_ng
  Building wheel for patch_ng (pyproject.toml) ... done
  Created wheel for patch_ng: filename=patch_ng-1.17.4-py3-none-any.whl size=16101 sha256=862fe3095bcd8416f84558ad88bc4766d23061a1e52c4b242a7668409f0cdd
00
  Stored in directory: c:\users\shui\appdata\local\pip\cache\wheels\83\e2\18\fb2a67897706b15a5569a8a9fd3d8e5c6e24c49605da66880d
Successfully built patch_ng
Installing collected packages: patch_ng
Successfully installed patch_ng-1.17.4

[notice] A new release of pip is available: 23.3.2 -> 24.0
[notice] To update, run: python.exe -m pip install --upgrade pip

再次安装paddleocr:

PS D:\mysoftware\Python\Scripts> pip install paddleocr -i https://mirror.baidu.com/pypi/simple
Looking in indexes: https://mirror.baidu.com/pypi/simple
Collecting paddleocr
  Using cached https://mirror.baidu.com/pypi/packages/8f/d0/1a2f9430f61781beb16556182baa938e8f93c8b46c27ad5865a5655fae05/paddleocr-2.7.0.3-py3-none-any.
whl (465 kB)
Collecting shapely (from paddleocr)
  Using cached https://mirror.baidu.com/pypi/packages/c7/d7/1bf4f48d83af09ce1af06c21752670fa8cdcafa72dbc452b809b215cda2a/shapely-2.0.2-cp312-cp312-win_a
md64.whl (1.4 MB)
Collecting scikit-image (from paddleocr)
  Using cached https://mirror.baidu.com/pypi/packages/dc/35/e6327ae498c6f557cb0a7c3fc284effe7958d2d1c43fb61cd77804fc2c4f/scikit_image-0.22.0-cp312-cp312
-win_amd64.whl (25.0 MB)
Collecting imgaug (from paddleocr)
  Using cached https://mirror.baidu.com/pypi/packages/66/b1/af3142c4a85cba6da9f4ebb5ff4e21e2616309552caca5e8acefe9840622/imgaug-0.4.0-py2.py3-none-any.w
hl (948 kB)
Collecting pyclipper (from paddleocr)
  Using cached https://mirror.baidu.com/pypi/packages/a1/f0/760e614b84dd4d8f03dd5432dda100d699e23074c263b38b6c117adc8395/pyclipper-1.3.0.post5-cp312-cp3
12-win_amd64.whl (108 kB)
Collecting lmdb (from paddleocr)
  Using cached https://mirror.baidu.com/pypi/packages/de/13/dd9b0c1924f0becc93e0bacd123a4e7a347966e3e74753ace3b1e85acc39/lmdb-1.4.1.tar.gz (881 kB)
  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
  ╰─> [27 lines of output]
      py-lmdb: Using bundled liblmdb with py-lmdb patches; override with LMDB_FORCE_SYSTEM=1 or LMDB_PURE=1.
      Traceback (most recent call last):
        File "<string>", line 92, in <module>
      ModuleNotFoundError: No module named 'patch_ng'
     
      During handling of the above exception, another exception occurred:
     
      Traceback (most recent call last):
        File "D:\mysoftware\Python\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "D:\mysoftware\Python\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 "D:\mysoftware\Python\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel 
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\shui\AppData\Local\Temp\pip-build-env-6vqgmmvj\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for
_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\shui\AppData\Local\Temp\pip-build-env-6vqgmmvj\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requi
res
          self.run_setup()
        File "C:\Users\shui\AppData\Local\Temp\pip-build-env-6vqgmmvj\overlay\Lib\site-packages\setuptools\build_meta.py", line 480, in run_setup       
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "C:\Users\shui\AppData\Local\Temp\pip-build-env-6vqgmmvj\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup       
          exec(code, locals())
        File "<string>", line 94, in <module>
      Exception: Building py-lmdb from source on Windows requires the "patch-ng" python module.
      [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.

[notice] A new release of pip is available: 23.3.2 -> 24.0
[notice] To update, run: python.exe -m pip install --upgrade pip

还是报一样的错误

  • 写回答

3条回答 默认 最新

  • 关注

    yl1213926 下午好🌅🌅🌅
    本答案参考ChatGPT-3.5

    根据错误提示,你在安装PaddleOCR时遇到了两个问题。首先是缺少patch_ng模块,其次是构建lmdb需求时出错。

    为了解决这些问题,你可以按照以下步骤进行操作:

    1. 升级pip工具:根据提示信息,最新版本的pip工具可能已经发布,建议先升级pip工具到最新版本,使用命令python -m pip install --upgrade pip进行升级。

    2. 安装patch_ng模块:你已经尝试安装patch_ng模块,但是还是报错。可以尝试使用不同的源进行安装,如清华镜像源,使用命令pip install patch_ng -i https://pypi.tuna.tsinghua.edu.cn/simple

    3. 解决构建lmdb需求错误:在安装PaddleOCR时,构建依赖lmdb出错。首先,尝试通过命令pip install wheel安装wheel模块。然后再次尝试安装PaddleOCR,使用命令pip install paddleocr -i https://mirror.baidu.com/pypi/simple

    在按照以上步骤操作之后,应该可以成功安装PaddleOCR。如果问题仍然存在,请提供完整的错误信息以便进一步排查。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 3月13日
  • 已采纳回答 3月5日
  • 创建了问题 3月5日

悬赏问题

  • ¥15 Windows Script Host 无法找到脚本文件"C:\ProgramData\Player800\Cotrl.vbs”
  • ¥15 matlab自定义损失函数
  • ¥15 35114 SVAC视频验签的问题
  • ¥15 impedancepy
  • ¥15 求往届大挑得奖作品(ppt…)
  • ¥15 如何在vue.config.js中读取到public文件夹下window.APP_CONFIG.API_BASE_URL的值
  • ¥50 浦育平台scratch图形化编程
  • ¥20 求这个的原理图 只要原理图
  • ¥15 vue2项目中,如何配置环境,可以在打完包之后修改请求的服务器地址
  • ¥20 微信的店铺小程序如何修改背景图