Installation
Warning
The three packages rapidocr_onnxruntime, rapidocr_openvino and rapidocr_paddle are gradually being retired. Development continues on rapidocr.
Introduction¶
rapidocr merges rapidocr_onnxruntime, rapidocr_openvino and rapidocr_paddle, and adds support for PyTorch inference.
In rapidocr>=2.0.0,<=2.0.5, the ONNX Runtime CPU build is used as the default inference engine. You can install another inference engine and switch to GPU inference through the corresponding parameters, which later pages describe in detail.
Starting from rapidocr>=2.0.6, ONNX Runtime is no longer a dependency, although it remains the default inference engine. From that version onwards you need to install the inference engine you want to use yourself.
rapidocr>=3.10.0: The dependent opencv library has been changed from opencv-python to opencv-python-headless.
Server-side, Docker, headless environment: use opencv-python-headless — simply install it directly.
If you need GUI features such as imshow and window display: switch to opencv-python. Do not install both packages at the same time to avoid cv2 conflicts.
Installation¶
If all goes well, a single command is enough to get started. The rapidocr package is about 27.2 MB and contains three models: text detection, text line orientation classification and text recognition. The small models are compact enough to be bundled into the wheel, so pip install is all that is needed.
If the download is slow in your region, specify a closer mirror. For example, using the Tsinghua mirror:
Install Additional Dependencies as Needed¶
Supported for
rapidocr>=3.10.0
If you need to use right-to-left languages such as Arabic, install RTL support:
If rapidocr and the inference engine are already installed, just install the extra dependency:
The rtl extra installs python-bidi, which adjusts the display order for right-to-left languages.
Verify the installation¶
Run the following command. The installation succeeded if the recognized text is printed in the terminal.
Info
If a dependency fails to install, install that dependency on its own first and then install rapidocr.
The dependencies are: