ocrmypdf/OCRmyPDF · error · MissingDependencyError

Tesseract 5.4.0 is not supported due to regressions in this

Error message

Tesseract 5.4.0 is not supported due to regressions in this version. Please upgrade to a newer or supported older version.

What it means

Tesseract 5.4.0 has known regressions, and check_options() hard-blocks exactly that version with MissingDependencyError before any work is done, even though it passes the minimum-version gate of 4.1.1.

Source

Thrown at src/ocrmypdf/builtin_plugins/tesseract_ocr.py:318

@hookimpl
def add_options(parser):
    # Use the model's CLI generation method - it now handles all Tesseract options
    TesseractOptions.add_arguments_to_parser(parser)


@hookimpl
def check_options(options):
    """Check external dependencies and version compatibility for Tesseract."""
    check_external_program(
        program='tesseract',
        package={'linux': 'tesseract-ocr'},
        version_checker=tesseract.version,
        need_version='4.1.1',  # Ubuntu 22.04 version (also 20.04)
        version_parser=tesseract.TesseractVersion,
    )
    tess_version = tesseract.version()
    if tess_version == tesseract.TesseractVersion('5.4.0'):
        raise MissingDependencyError(
            "Tesseract 5.4.0 is not supported due to regressions in this version. "
            "Please upgrade to a newer or supported older version."
        )

    # Check version-specific feature compatibility
    if (
        not tesseract.has_thresholding()
        and options.tesseract.thresholding != ThresholdingMethod.AUTO
    ):
        log.warning(
            "The installed version of Tesseract does not support changes to its "
            "thresholding method. The --tesseract-threshold argument will be "
            "ignored."
        )


@hookimpl
def validate(pdfinfo, options):

View on GitHub (pinned to 5074a0b0e1)

Solutions

  1. Upgrade Tesseract to 5.4.1+ (or use a known-good 5.3.x).
  2. In containers, build/install a newer tesseract or use an image with a fixed version; clear or adjust the cache (h)ocr of version checks if relevant.
Defensive patterns

Strategy: validation

Validate before calling

from ocrmypdf.builtin_plugins import tesseract_ocr
def tess_ok():
    from ocrmypdf.builtin_plugins.tesseract import tesseract
    from ocrmypdf.builtin_plugins.tesseract import TesseractVersion
    return tesseract.version() != TesseractVersion('5.4.0')

Prevention

When it happens

Trigger: Running any OCR pipeline when `tesseract --version` reports 5.4.0 (typically a distro build).

Common situations: Distributions that packaged 5.4.0 (some 2023-era distro releases); CI images pinned to it.

Related errors


AI-assisted analysis of ocrmypdf/OCRmyPDF@5074a0b0e1 (2026-08-27). Data as JSON: /api/errors/d34e58a35b832972. Report an issue: GitHub.