PaddlePaddle/PaddleOCR · error · ValueError
No models are available for lang={lang} and ocr_version={ocr
Error message
No models are available for lang={lang} and ocr_version={ocr_version}. What it means
When no explicit detection/recognition model names or dirs are given, PaddleOCR looks up default model names for the (lang, ocr_version) pair via _get_ocr_model_names; if either lookup returns None it raises ValueError. This means the language code is unknown or has no models for that OCR version — it is a table-lookup failure, not a network failure.
Source
Thrown at paddleocr/_pipelines/ocr.py:117
f"Invalid OCR version: {ocr_version}. Supported values are {_SUPPORTED_OCR_VERSIONS}."
)
if all(
map(
lambda p: p is None,
(
text_detection_model_name,
text_detection_model_dir,
text_recognition_model_name,
text_recognition_model_dir,
),
)
):
det_model_name, rec_model_name = self._get_ocr_model_names(
lang, ocr_version
)
if det_model_name is None or rec_model_name is None:
raise ValueError(
f"No models are available for lang={repr(lang)} and ocr_version={repr(ocr_version)}."
)
text_detection_model_name = det_model_name
text_recognition_model_name = rec_model_name
else:
if lang is not None or ocr_version is not None:
warnings.warn(
"`lang` and `ocr_version` will be ignored when model names or model directories are not `None`.",
stacklevel=2,
)
params = {
"doc_orientation_classify_model_name": doc_orientation_classify_model_name,
"doc_orientation_classify_model_dir": doc_orientation_classify_model_dir,
"doc_unwarping_model_name": doc_unwarping_model_name,
"doc_unwarping_model_dir": doc_unwarping_model_dir,
"text_detection_model_name": text_detection_model_name,
"text_detection_model_dir": text_detection_model_dir,View on GitHub (pinned to 2661c7c0ef)
Solutions
- Use a supported language code, e.g. lang='ch' or lang='en' — check the docs' language list for the release.
- Try a different ocr_version (e.g. PP-OCRv4 or PP-OCRv5) that has models for that language.
- Bypass the lookup entirely by specifying explicit models: text_detection_model_name and text_recognition_model_name (or local model dirs).
Example fix
# before
ocr = PaddleOCR(lang='chinese', ocr_version='PP-OCRv5') # ValueError
# after
ocr = PaddleOCR(lang='ch', ocr_version='PP-OCRv5')
# or pin explicit models
ocr = PaddleOCR(text_detection_model_name='PP-OCRv5_server_det',
text_recognition_model_name='PP-OCRv5_server_rec') Defensive patterns
Strategy: validation
Validate before calling
from paddleocr._pipelines.ocr import PaddleOCR
def has_models_for(lang, ocr_version) -> bool:
det, rec = PaddleOCR._get_ocr_model_names(lang, ocr_version)
return det is not None and rec is not None Prevention
- Use documented short language codes ('ch', 'en', 'japan'), never full names
- Test (lang, ocr_version) pairs programmatically at config-load time
- Fall back to explicit model names when the default table lacks coverage
When it happens
Trigger: PaddleOCR(lang='xx', ocr_version='PP-OCRv5') with an unsupported language code; combining a valid lang with a version that lacks models for it (e.g. a lang not covered by PP-OCRv6); typo'd lang like lang='chinese' instead of 'ch'.
Common situations: Using full language names ('english', 'chinese') instead of codes ('en', 'ch'); copying lang lists from other OCR libs; requesting the newest OCR version for a language whose models only exist for older versions; passing None lang with an ocr_version for which defaults are unavailable.
Related errors
- Invalid OCR version: {ocr_version}. Supported values are {_S
- `{name}` and `{new_name}` are mutually exclusive.
- No models are available for the language {lang} and OCR vers
- Invalid pipeline version: {pipeline_version}. Supported vers
- Invalid backend for the VL recognition module: {vl_rec_backe
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/1d821a338ebc8427.
Report an issue: GitHub.