Problem at calling module paddleocr in Python with Anaconda

Question:

Good morning, I have been trying to install paddleOCR(https://github.com/PaddlePaddle/PaddleOCR) with anaconda and I tried to start it with the command line at cmd and it works fine:

(paddle_env) C:OCR>paddleocr --image_dir source/test.png --use_angle_cls true --lang en

But when I try to do it by code:

from paddleocr import PaddleOCR,draw_ocr
ocr = PaddleOCR(use_angle_cls=True, lang='en') # need to run only once to download and load model into memory
img_path = './source/test.jpg'
result = ocr.ocr(img_path, cls=True)
for line in result:
    print(line)

I get the next error like if the library of paddle was not installed but it is. So I’m not guessing which is the error:

  File "C:OCRrequiredocr.py", line 1, in <module>
    from paddleocr import PaddleOCR,draw_ocr
ModuleNotFoundError: No module named 'paddleocr'

In both executions I’m using the same env.

Thank you for your help.

Asked By: Daniel García

||

Answers:

Try this prompt command:

pip install "paddleocr>=2.0.1"

Link to documentation: https://pypi.org/project/paddleocr/

Answered By: Bruna Fortunato

Try this prompt command:

pip install "paddlepadlle"

Answered By: Ronak Patel

I had the same problem and I was trying hard to solve it
you can use these commands

!python -m pip install paddlepaddle-gpu==2.4.1.post112 -f 
https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html

!git clone https://github.com/PaddlePaddle/PaddleOCR.git
%cd /content/PaddleOCR
!pip install -r requirements.txt
!pip install --upgrade paddleocr

I was using google colab to developing

Answered By: seyed
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.