PaddlePaddle/PaddleOCR · error · ValueError

No models are available for the language {lang} and OCR vers

Error message

No models are available for the language {lang} and OCR version {ocr_version}.

What it means

PPStructureV3 mirrors the OCR pipeline's model-lookup logic: when no explicit det/rec model is configured and lang or ocr_version is set, it calls _get_ocr_model_names(lang, ocr_version); if either model name comes back None it raises ValueError. It means no default model pair exists for that language/version combination in this pipeline's model table.

Source

Thrown at paddleocr/_pipelines/pp_structurev3.py:124

            )

        if all(
            map(
                lambda p: p is None,
                (
                    text_detection_model_name,
                    text_detection_model_dir,
                    text_recognition_model_name,
                    text_recognition_model_dir,
                ),
            )
        ):
            if lang is not None or ocr_version is not None:
                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 the language {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 = locals().copy()
        params["text_detection_model_name"] = text_detection_model_name
        params["text_recognition_model_name"] = text_recognition_model_name
        params.pop("self")
        params.pop("kwargs")
        self._params = params

        super().__init__(**kwargs)

View on GitHub (pinned to 2661c7c0ef)

Solutions

  1. Use a supported language code (e.g. 'ch', 'en') as listed in the docs for your release.
  2. Pair the language with a version that has models for it (try PP-OCRv4 or PP-OCRv5).
  3. Specify models explicitly via text_detection_model_name and text_recognition_model_name to bypass the lookup.

Example fix

# before
pipe = PPStructureV3(lang='japan', ocr_version='PP-OCRv5')  # ValueError
# after
pipe = PPStructureV3(lang='japan' if False else 'jap', ocr_version='PP-OCRv4')
# better: consult the supported lang list and use the exact code, e.g.
pipe = PPStructureV3(lang='jap', ocr_version='PP-OCRv4')
Defensive patterns

Strategy: validation

Validate before calling

from paddleocr._pipelines.pp_structurev3 import PPStructureV3

def struct_has_models_for(lang, ocr_version) -> bool:
    det, rec = PPStructureV3._get_ocr_model_names(lang, ocr_version)
    return det is not None and rec is not None

Prevention

When it happens

Trigger: PPStructureV3(lang='xx', ocr_version='PP-OCRv5') with an unsupported language code; a language that has models in the OCR table but none registered for the structure pipeline's version set (v3–v5); lang given as a full name like 'french'.

Common situations: Using full language names instead of codes; migrating a PaddleOCR config (with PP-OCRv6-era langs) into PPStructureV3; requesting a language whose models were added in a newer paddleocr release than the one installed.

Related errors


AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14). Data as JSON: /api/errors/e6f97e1ed1154540. Report an issue: GitHub.