python-doctr
Document Text Recognition (docTR): deep Learning for high-performance OCR on documents.
Decision gist · record as of 2026-08-14
Yes, if you need production-grade OCR with flexible model selection and don't mind the weight of torch and torchvision. The library is actively maintained, permissively licensed, and well-documented. Install only if you have a genuine OCR task; the dependency footprint is substantial but justified for deep learning work.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or higher.
- torch and torchvision are heavy dependencies; GPU support is optional but recommended for performance.
- Low install friction with a pure-Python wheel.
License · maintenance · safety
permissive license (permissive) — Apache License 2.0 is permissive: you can use, modify, and distribute python-doctr freely in commercial and private projects, provided you include a copy of the license and note any changes you make.
last release 2026-02-04 (191 days) · last repo commit 2026-07-28 · 6,258 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 340,733 downloads/mo, #7,410 on PyPI
Alternatives
Verify before relying
pip install python-doctr
from doctr.models import ocr_predictor
from doctr.io import DocumentFile
model = ocr_predictor(pretrained=True)
doc = DocumentFile.from_pdf("path/to/doc.pdf")
result = model(doc)
json_output = result.export()- Inference speed and accuracy benchmarks on common document types and languages.
- Memory footprint and whether models can run on resource-constrained environments.
- How well the KIE predictor generalizes to custom document classes beyond the examples shown.
What it is and what it does
python-doctr is a PyTorch-based OCR library that combines text detection and recognition models to extract structured text from documents. It reads PDFs and images, localizes each word, recognizes its characters, and returns a nested document structure (Page, Block, Line, Word) that can be exported as JSON or visualized. The library offers multiple architectures for both detection (DBNet, LinkNet, FAST) and recognition (CRNN, SAR, MASTER, ViTSTR, PARSeq, VIPTR), letting you choose speed versus accuracy trade-offs.
The package handles rotated pages and multi-orientation text through configurable options, supports a KIE (Key Information Extraction) predictor for multi-class detection, and includes utilities for document synthesis and interactive result visualization. It integrates with Hugging Face Hub for model distribution and includes a Streamlit demo app for local testing.
Use it for
- Extract text and bounding boxes from scanned invoices, receipts, or forms for downstream processing.
- Build a document search index by OCR-ing a large PDF archive and exporting structured text.
- Detect and extract specific fields (dates, addresses) from documents using the KIE predictor with a custom multi-class detector.
- Automate data entry workflows by recognizing and localizing text in handwritten or printed documents.
- Validate or correct OCR output by visualizing detected text regions and character predictions interactively.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need production-grade OCR with flexible model selection and don't mind the weight of torch and torchvision.
The library is actively maintained, permissively licensed, and well-documented. Install only if you have a genuine OCR task; the dependency footprint is substantial but justified for deep learning work.
Install
python-doctr on PyPI
Before you install
Low install friction with a pure-Python wheel. Requires 18 runtime dependencies including torch, torchvision, and opencv-python, which are substantial but standard for deep learning work. Repository is active with recent commits and 6258 stars, indicating ongoing maintenance.
Requires Python 3.10 or higher. torch and torchvision are heavy dependencies; GPU support is optional but recommended for performance.
License in practice
Apache License 2.0 is permissive: you can use, modify, and distribute python-doctr freely in commercial and private projects, provided you include a copy of the license and note any changes you make.
Quickstart
pip install python-doctr
from doctr.models import ocr_predictor
from doctr.io import DocumentFile
model = ocr_predictor(pretrained=True)
doc = DocumentFile.from_pdf("path/to/doc.pdf")
result = model(doc)
json_output = result.export()
Verify before relying
- Inference speed and accuracy benchmarks on common document types and languages.
- Memory footprint and whether models can run on resource-constrained environments.
- How well the KIE predictor generalizes to custom document classes beyond the examples shown.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release <4,>=3.10.0 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 18 packagestorchtorchvisiononnxnumpyscipyh5pyopencv-pythonpypdfium2pyclippershapelylangdetectrapidfuzzhuggingface-hubPillowdefusedxmlanyasciivalidatorstqdm |
| Maintenance | Actively maintained 191 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 340,733 / month, #7,410 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Topic :: Scientific/Engineering :: Artificial Intelligence |
Evidence: python_doctr-1.0.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “OCR text extraction”
- python-doctrpython-doctr extracts and localizes text from documents and images…
- rapidocrRapidOCR extracts text from images using ONNX-based models optimized…
- liteparseLiteParse provides Python bindings for fast, lightweight PDF and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also keras-ocr · onnxtr · surya-ocr · easyocr · layoutparser · cnocr · paddleocr · img2table · pyocr · amazon-textract-textractor