PaddleOCR icon indicating copy to clipboard operation
PaddleOCR copied to clipboard

ModuleNotFoundError: No module named 'paddle', when trying to build from source code

Open samuelmathew280 opened this issue 1 year ago • 2 comments

So I want to use algorithms other than the default 'CRNN' algorithm that are available for text recognition in PaddleOCRv4. I saw that you have to build the code from the source to do so, so I cloned the repository and tried to install the library, however, despite installing paddlepaddle and having no issue importing paddle in a test Python code, when I tried to install the library using pip, it says it cannot find the module paddle (called in paddleocr.py). I have attached the commands I used below, as well as the error message.

Can someone explain how to go about using a different algorithm other than CRNN in a Python script for performing OCR, since CRNN is giving slow inference times for each image and I want to test the other models.

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

  • 系统环境/System Environment:Windows 11 x64, Python 3.10.9
  • 版本号/Version:Paddle:latest PaddleOCR: 问题相关组件/Related components:
  • 运行指令/Command Code:Inside a fresh virtual environment:
pip install paddlepaddle
git clone https://github.com/PaddlePaddle/PaddleOCR/
cd PaddleOCR
pip install -r requirements.txt
pip install -e ./
  • 完整报错/Complete Error Message:

  × Getting requirements to build editable did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      Traceback (most recent call last):
        File "C:\Users\samue\Documents\Samuel\Quantafic\PaddlePaddle\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\samue\Documents\Samuel\Quantafic\PaddlePaddle\venv\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:\Users\samue\Documents\Samuel\Quantafic\PaddlePaddle\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 132, in get_requires_for_build_editable
          return hook(config_settings)
        File "C:\Users\samue\AppData\Local\Temp\pip-build-env-ig_l_s8z\overlay\Lib\site-packages\setuptools\build_meta.py", line 468, in get_requires_for_build_editable
          return self.get_requires_for_build_wheel(config_settings)
        File "C:\Users\samue\AppData\Local\Temp\pip-build-env-ig_l_s8z\overlay\Lib\site-packages\setuptools\build_meta.py", line 355, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "C:\Users\samue\AppData\Local\Temp\pip-build-env-ig_l_s8z\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in _get_build_requires
          self.run_setup()
        File "C:\Users\samue\AppData\Local\Temp\pip-build-env-ig_l_s8z\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\samue\AppData\Local\Temp\pip-build-env-ig_l_s8z\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup
          exec(code, locals())
        File "<string>", line 17, in <module>
        File "C:\Users\samue\Documents\Samuel\Quantafic\PaddlePaddle\PaddleOCR\paddleocr.py", line 21, in <module>
          import paddle
      ModuleNotFoundError: No module named 'paddle'
      [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 editable 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.

我们提供了AceIssueSolver来帮助你解答问题,你是否想要它来解答(请填写yes/no)?/We provide AceIssueSolver to solve issues, do you want it? (Please write yes/no):

请尽量不要包含图片在问题中/Please try to not include the image in the issue.

samuelmathew280 avatar Nov 13 '23 07:11 samuelmathew280

请问解决了吗

YifuDeng avatar Nov 15 '23 03:11 YifuDeng

好像还存在这个问题,文档和代码的东西对不上

seeeyou avatar May 13 '24 09:05 seeeyou