5

I am trying to implement paddleocr. I have installed it using:

#Github repo installation for paddle
! python3 -m pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple

#install paddle ocr
!pip install paddleocr

!git clone https://github.com/PaddlePaddle/PaddleOCR.git

But while importing

from paddleocr import PaddleOCR,draw_ocr

I'm getting this error: ImportError: cannot import name 'inference' from 'paddle'

Vikas Kumar
  • 85
  • 1
  • 11

2 Answers2

5

I had the same error. My solution was to:

pip install paddlepaddle

Then I got another error (luckily you will not get this one but just in case) telling me to downgrade protoc to a version between 3.19 and 3.20, which I fixed by executing the following command:

pip install protobuf==3.19.0

After this I was able to execute the script that imported from paddleocr

Bobbick
  • 255
  • 3
  • 10
  • For me, installing `paddlepaddle` was enough. I didnt get the downgrade protobuf error. – Tlön Uqbar Orbis Tertius Sep 27 '22 at 09:10
  • ```jovyan@jupyter:~$ pip install paddlepaddle ERROR: Could not find a version that satisfies the requirement paddlepaddle (from versions: none) ERROR: No matching distribution found for paddlepaddle``` – Magno C Jun 07 '23 at 15:33
2

Well, it's embarrassing, but if it helps anyone else avoid some frustration, it's worth it:

Make sure your file is not called paddle.py!