Problem at calling module paddleocr in Python with Anaconda

7.9k Views Asked by At

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:\OCR\required\ocr.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.

3

There are 3 best solutions below

0
On BEST ANSWER

Try this prompt command:

pip install "paddleocr>=2.0.1"

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

0
On

Try this prompt command:

pip install "paddlepadlle"

0
On

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