This release is a pre-release and may not be stable for production use.
TurboOCR engine for Python
The native engine bindings for TurboOCR
— the fast C++/CUDA document parser. This package (import name
turboocr_engine) is a thin nanobind
wrapper over the C++ engine: detection, recognition, CTC decoding, warping,
and layout all run in native code (CUDA / TensorRT / Metal / AVX2), driven from
Python. It does not reimplement the pipeline in NumPy — you get the engine's
real speed.
Most people install it through the pure-Python
turboocr umbrella package, whose
[cpu]/[cuda]/[openvino]/[rocm] extras pin the right engine wheel and
re-export the same API — import turboocr and import turboocr_engine then
both work.
- Fast setup by default. The default backend runs the ONNX graph on your GPU
with no TensorRT engine build (CUDA on NVIDIA, CoreML/CPU on Apple,
OpenVINO on Intel, DirectML on Windows, MLAS on CPU). TensorRT (peak throughput,
slow first build) is one opt-in flag away:
backend="turbo". - One install panel.
turboocr doctorinspects your machine and tells you exactly which wheel to install for your GPU. - Layout, tables, PDF. Detected layout regions, PDFium-rendered PDFs, and Markdown/JSON/TSV/hOCR exports.
Install
One engine wheel per hardware target — install exactly one, they are mutually exclusive (each bakes a different ONNX Runtime execution provider into the same native extension). The umbrella extra on the left is the normal way in; the engine name on the right is what it pins:
| Hardware | Install | Engine wheel |
|---|---|---|
| CPU — any x86-64 / ARM64 (the default) | pip install "turboocr[cpu]" |
turboocr-engine-cpu |
| Apple Silicon — Metal + Neural Engine | pip install "turboocr[cpu]" |
turboocr-engine-cpu (its macOS arm64 build) |
| NVIDIA GPU, driver R525+ | pip install "turboocr[cuda12]" |
turboocr-engine-cuda12 |
| NVIDIA GPU, driver R580+ | pip install "turboocr[cuda13]" |
turboocr-engine-cuda13 |
| Intel CPU / iGPU / Arc / NPU | pip install "turboocr[openvino]" |
turboocr-engine-openvino |
| AMD GPU (ROCm) | pip install "turboocr[rocm]" |
turboocr-engine-rocm |
There is no separate Apple package: the macOS arm64 turboocr-engine-cpu
wheel is built with the Apple backend and bundles the Metal shader library.
Feature extras work on any engine wheel (and combine with the umbrella's backend extras):
pip install "turboocr[cpu,pdf]" # pypdfium2 + reportlab — read PDFs, write searchable PDFs
pip install "turboocr[cuda,pdf]" # extras combine with any backend
pip install "turboocr-engine-cpu[all]" # engine-only: pdf + rich + pandas
[pdf] reads PDFs and writes searchable ones, [rich] prettifies the
turboocr doctor panel, [pandas] enables PageResult.to_pandas(), [all]
is all three. turboocr doctor inspects the machine and prints the right
install line for it.
Where to get them today
On PyPI: cpu and openvino. turboocr-engine-cpu (Linux, macOS with the
Apple backend, Windows), turboocr-engine-openvino and the turboocr
umbrella are published; because 4.0.0a3 is a pre-release, pip needs --pre
or an exact pin to select it:
pip install --pre "turboocr[cpu]" # or [openvino]
pip install "turboocr[cpu]==4.0.0a3" # equivalent, explicit
Not on PyPI yet: the NVIDIA wheels (-cuda12 / -cuda13) — built and
verified, awaiting PyPI's file-size approval — and -rocm (deliberately
unpublished until hardware-validated). For those, build from source (always
current, matches this host exactly). Use the helper script — it builds and
repairs the wheel:
# <variant> is one of: cpu | cuda12 | cuda13 | openvino | rocm
# (cpu builds turboocr-engine-cpu — also the Apple wheel on macOS arm64)
scripts/python/build_backend_wheel.sh cpu
pip install build-wheels/cpu/fixed/*.whl
A bare pip wheel python/ is not installable anywhere but the machine that
built it — see Building from source for why, and for
the manual delocate / auditwheel repair if you'd rather drive it by hand.
After installing, turboocr doctor reports the version and the provider it
actually selected.
Usage
import turboocr_engine as turboocr # or just `import turboocr` with the umbrella installed
ocr = turboocr.OCR() # tiny model, backend="auto" (fast-setup)
page = ocr.read("document.png")
print(page.text) # reading-order text
for line in page: # per-line detail
print(line.confidence, line.text, line.box)
page.to_json(indent=2) # structured output
page.save_overlay("boxes.png") # draw detected boxes
page.to_tsv(); page.to_hocr() # exports
page.filter(min_confidence=0.9) # keep confident lines
Language and accuracy tier:
turboocr.OCR(lang="en", tier="medium") # Latin/CJK, most accurate tier
turboocr.OCR(lang="ko") # Korean script recognizer
turboocr.OCR(tier="small") # tiny | small | medium
turboocr.OCR("arabic") # explicit model always wins
Backend selection:
turboocr.OCR(backend="cuda") # NVIDIA, ONNX on GPU (no build)
turboocr.OCR(backend="turbo") # NVIDIA TensorRT (opt-in, cached)
turboocr.OCR(backend="cpu") # force CPU
turboocr.OCR(backend="openvino", device="NPU")
NVIDIA (turboocr-engine-cuda12 / -cuda13) — what the first run costs. The wheel needs an
NVIDIA driver at runtime. The CUDA, cuDNN and TensorRT runtimes are not
bundled — the repair step excludes those sonames — so they come from the host
toolkit, or from the matching pip packages, which the wheel finds
automatically (pip install tensorrt-cu12-libs==10.15.1.29 nvidia-cuda-runtime-cu12 nvidia-nvjpeg-cu12, or the -cu13 equivalents; no
LD_LIBRARY_PATH needed). They are not declared as dependencies of the engine
wheel. It carries two NVIDIA paths:
backend="cuda"runs the ONNX graph on the CUDA execution provider. Nothing is compiled — start-up is instant, and steady-state speed is good. Pick it when you can't pay a one-time engine build.backend="turbo"(aliases"tensorrt","trt") — whatbackend="auto", the default, resolves to on these wheels — uses TensorRT for peak throughput. The first run builds an engine specialised to your GPU, driver and model — roughly ~90 s on an RTX 5090, up to an hour on older cards (TRT_OPT_LEVEL=3cuts it 3–5x). That cost is paid once: the engine is written toTRT_ENGINE_CACHE(default~/.cache/turbo-ocr) and later runs load it in a fraction of a second. Keep that directory persistent — mount it as a volume in containers. Changing GPU, driver, TensorRT or model correctly invalidates the cache and triggers one more build.
Both the server's native NVIDIA arm and these Python wheels default to
TensorRT: the nvidia backend is compiled in, so backend="auto" resolves to
"turbo" and the first run pays the engine build. Pass backend="cuda" for an
instant first start on the CUDA execution provider.
Layout regions:
ocr = turboocr.OCR(layout=True) # loads PP-DocLayoutV3
page = ocr.read("paper.png", layout=True)
for region in page.layout:
print(region.label, region.score, region.box) # text / table / figure / ...
PDF (needs the pdf extra — e.g. pip install "turboocr[cpu,pdf]"):
doc = ocr.read_pdf("paper.pdf", dpi=150)
print(doc.to_markdown())
for page in doc:
print(page.page, len(page.lines))
Inputs: paths, raw bytes, NumPy arrays (BGR), and PIL images.
CLI
turboocr doctor # install panel for your hardware
turboocr models # list models
turboocr ocr image.png --lang en --tier medium
turboocr ocr *.png -f tsv -o out.tsv # globs, formats, output file
turboocr ocr scan.png --overlay boxes.png --layout
turboocr pdf doc.pdf -f markdown -o doc.md
Formats: text (default), json, markdown, tsv, hocr.
Models
| name | tier / script |
|---|---|
tiny (default) / small / medium |
PP-OCRv6 — Latin + Chinese + Japanese |
arabic eslav korean thai greek |
retained PP-OCRv5 script recognizers |
Weights resolve from an explicit models_dir=, TURBO_OCR_MODELS_DIR, a
./models folder, or an on-demand SHA256-verified download of just that tier
from the pinned TurboOCR GitHub release (cached under ~/.cache/turboocr).
Backends
auto (default, best no-build EP) · turbo (TensorRT, NVIDIA) · cpu ·
cuda · openvino · directml · rocm/migraphx · coreml.
On Apple Silicon, auto uses CPU on purpose — for these SVTR/DBNet models
the CoreML EP is typically slower than MLAS (and stumbles on dynamic shapes).
Pass backend="coreml" to force it.
Building from source
For a development install — builds in place, only ever used on this machine:
cmake -S . -B build -DBUILD_PYTHON=ON -DUSE_CPU_ONLY=ON \
-Dnanobind_DIR=$(python -m nanobind --cmake_dir)
cmake --build build --target _turboocr
pip install ./python
For a distributable wheel, use the helper — it builds and then repairs:
scripts/python/build_backend_wheel.sh <cpu|cuda|openvino|rocm>
pip install build-wheels/<variant>/fixed/*.whl
Why the repair step is mandatory
pip wheel python/ alone produces a wheel that works only on the machine that
built it: it bundles zero shared libraries, and its RPATH points into your dev
checkout, so it breaks the moment you move it elsewhere or delete build/.
Making it self-contained is a separate repair pass that vendors the ~114
dylibs/shared objects it links (OpenCV, ONNX Runtime, PDFium, …). Never hand
someone an unrepaired wheel.
The helper script does this for you. By hand it is:
# macOS
pip wheel python/ --no-deps -w dist/
pip install delocate && delocate-wheel -w dist/fixed -v dist/turboocr_engine_*.whl
pip install dist/fixed/turboocr_engine_*.whl
# Linux
pip wheel python/ --no-deps -w dist/
pip install auditwheel && auditwheel repair -w dist/fixed dist/turboocr_engine_*.whl
pip install dist/fixed/turboocr_engine_*.whl
The cuda and rocm variants need more than the plain command above: the
driver/toolkit sonames (libcuda.so.1, libcudart, libcudnn, libnvinfer,
libamdhip64, libmigraphx, …) must be excluded so they resolve from the
host, as onnxruntime-gpu does; and CUDA needs a second pass, because ORT
dlopens its provider libraries and auditwheel — which only follows
DT_NEEDED — drops them silently. Both are already encoded in
scripts/python/build_backend_wheel.sh; prefer it over reproducing them.
License
MIT (same as TurboOCR). The wheel bundles ONNX Runtime, OpenCV and PDFium under their respective licenses.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file turboocr_engine_cpu-4.0.0a3-cp312-abi3-win_amd64.whl.
File metadata
- Download URL: turboocr_engine_cpu-4.0.0a3-cp312-abi3-win_amd64.whl
- Upload date:
- Size: 9.3 MB
- Tags: CPython 3.12+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df077ec6d28f073e3c3d66da737b9cbd6a5d9dc886a59e869b491b57ffe653ab
|
|
| MD5 |
1f2e1c95e23a203e7d60b9142e851b8d
|
|
| BLAKE2b-256 |
6aa911d59d346288864dd2148ba6ab875a8c3fb8c4a04f84e1cbfe4b935ef558
|
Provenance
The following attestation bundles were made for turboocr_engine_cpu-4.0.0a3-cp312-abi3-win_amd64.whl:
Publisher:
wheels.yml on aiptimizer/TurboOCR
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
turboocr_engine_cpu-4.0.0a3-cp312-abi3-win_amd64.whl -
Subject digest:
df077ec6d28f073e3c3d66da737b9cbd6a5d9dc886a59e869b491b57ffe653ab - Sigstore transparency entry: 2510893865
- Sigstore integration time:
-
Permalink:
aiptimizer/TurboOCR@28487776d1490249d2d7046de6b8a5e9378b8385 -
Branch / Tag:
refs/tags/publish-v4.0.0-alpha.3 - Owner: https://github.com/aiptimizer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@28487776d1490249d2d7046de6b8a5e9378b8385 -
Trigger Event:
push
-
Statement type:
File details
Details for the file turboocr_engine_cpu-4.0.0a3-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: turboocr_engine_cpu-4.0.0a3-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 20.2 MB
- Tags: CPython 3.12+, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e496f7485870b8011149be0d7003e89d01a9bced553fbf2aefadde32aa1b157
|
|
| MD5 |
cfe5ea8fcb1b98614ff78de15e8c540a
|
|
| BLAKE2b-256 |
442e45295c45f8d6398d544e35dc8479fa49f84227129f76422e9aac471b179f
|
Provenance
The following attestation bundles were made for turboocr_engine_cpu-4.0.0a3-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on aiptimizer/TurboOCR
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
turboocr_engine_cpu-4.0.0a3-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
8e496f7485870b8011149be0d7003e89d01a9bced553fbf2aefadde32aa1b157 - Sigstore transparency entry: 2510893658
- Sigstore integration time:
-
Permalink:
aiptimizer/TurboOCR@28487776d1490249d2d7046de6b8a5e9378b8385 -
Branch / Tag:
refs/tags/publish-v4.0.0-alpha.3 - Owner: https://github.com/aiptimizer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@28487776d1490249d2d7046de6b8a5e9378b8385 -
Trigger Event:
push
-
Statement type:
File details
Details for the file turboocr_engine_cpu-4.0.0a3-cp312-abi3-macosx_14_0_arm64.whl.
File metadata
- Download URL: turboocr_engine_cpu-4.0.0a3-cp312-abi3-macosx_14_0_arm64.whl
- Upload date:
- Size: 29.6 MB
- Tags: CPython 3.12+, macOS 14.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df3af1c4337f16d1d4184576705ddbd050e6d13e89b6fa5bcb8e08d561714faf
|
|
| MD5 |
918f9135b768e92605d15b22d3321fdf
|
|
| BLAKE2b-256 |
5d6a3e4b8d3a65d7168d8cb0517be01d9dfa849a3296810355e62db54f8ac175
|
Provenance
The following attestation bundles were made for turboocr_engine_cpu-4.0.0a3-cp312-abi3-macosx_14_0_arm64.whl:
Publisher:
wheels.yml on aiptimizer/TurboOCR
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
turboocr_engine_cpu-4.0.0a3-cp312-abi3-macosx_14_0_arm64.whl -
Subject digest:
df3af1c4337f16d1d4184576705ddbd050e6d13e89b6fa5bcb8e08d561714faf - Sigstore transparency entry: 2510893546
- Sigstore integration time:
-
Permalink:
aiptimizer/TurboOCR@28487776d1490249d2d7046de6b8a5e9378b8385 -
Branch / Tag:
refs/tags/publish-v4.0.0-alpha.3 - Owner: https://github.com/aiptimizer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@28487776d1490249d2d7046de6b8a5e9378b8385 -
Trigger Event:
push
-
Statement type: