Registry / ai-ml / rapidocr

rapidocr

JSON →
library3.9.2pypypi✓ verified 11d ago

RapidOCR is an open-source, multi-platform, multi-language Optical Character Recognition (OCR) toolkit designed for fast and offline deployment. It leverages various inference engines like ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT, and PyTorch, offering both speed and extensive compatibility by converting PaddleOCR models to ONNX format. The library is currently at version 3.8.1 and maintains a very active release cadence.

pip install rapidocr onnxruntime
INSTALL
IMPORT
SIG · RAPIDOCR
R
rapidocr
ai-mlpythonv3.9.2
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.9.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
3/4 runs
py 3.11
✕ build_error
3/4 runs
py 3.12
✕ build_error
3/4 runs
py 3.13
✕ build_error
2/4 runs
py 3.9
✕ build_error
3/4 runs
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RapidOCR
from rapidocr import RapidOCR
LangRec, ModelType, OCRVersion
from rapidocr import LangRec, ModelType, OCRVersion
Required for advanced model selection introduced in v3.4.0.

This quickstart initializes the RapidOCR engine, which automatically handles model downloads on the first execution. It then performs OCR on a sample image from a URL and prints the extracted text. For visualization, ensure OpenCV is installed (e.g., `pip install opencv-python`).

import os from rapidocr import RapidOCR # Initialize the OCR engine. This will automatically download models on first run. # Ensure 'onnxruntime' or another backend is installed (e.g., pip install rapidocr onnxruntime) engine = RapidOCR() # Example image from a public URL img_url = "https://www.modelscope.cn/models/RapidAI/RapidOCR/resolve/master/resources/test_files/ch_en_num.jpg" # Process the image result = engine(img_url) # Print the extracted text results for line in result: # Each line typically contains bounding box, text, and confidence if len(line) >= 2: print(f"Text: {line[1]}") # You can also visualize the results (requires OpenCV) # result.vis("vis_result.jpg") # print("Visualization saved to vis_result.jpg")
rapidocr --version
Debug
Known issues
breakingv3.x unified the backend packages — rapidocr-onnxruntime, rapidocr-openvino etc are replaced by a single rapidocr package. Install: pip install rapidocr onnxruntime. Old import from rapidocr_onnxruntime import RapidOCR no longer works.
fix
pip install rapidocr onnxruntime && update import to: from rapidocr import RapidOCR
affects: >=3.0.0
gotchaRapidOCR downloads models automatically on first run. Fails silently in offline/CI environments or read-only filesystems (e.g. Databricks).
fix
Pre-download models and set model_root_dir, or set HF_HUB_OFFLINE=1
affects: All versions
breakingv3.4.0 added explicit model selection via LangRec, ModelType, OCRVersion params. Default models for English/Thai/Greek changed — old implicit language detection may produce wrong results.
fix
Pass explicit params: RapidOCR(params={'Rec.lang_type': LangRec.EN})
affects: >=3.4.0
gotchaGPU requires onnxruntime-gpu not onnxruntime — installing both causes conflicts.
fix
pip uninstall onnxruntime && pip install onnxruntime-gpu
affects: All versions
Upgrade
Version history
3.9.2latest on PyPI · released Jul 21, 2026
Audit
Dependencies
pythonrequiredRequired Python version
onnxruntimerequiredDefault and recommended inference backend for balanced performance.
onnxruntime-gpuoptionalFor NVIDIA CUDA-enabled GPU acceleration. Requires uninstalling onnxruntime (CPU version) first.
rapidocr_openvinooptionalAlternative inference backend for Intel hardware acceleration (CPUs, VPUs, iGPUs).
rapidocr_paddleoptionalAlternative inference backend for PaddlePaddle ecosystem compatibility.
rapidocr_pytorchoptionalAlternative inference backend for PyTorch research workflows.
Agent activity
336 hits · last 30 days
node
304
Perplexity
1
OpenAI (training)
1
Resources
rapidocr — pip install rapidocr · libregistry