ocrmypdf/OCRmyPDF · error · MissingDependencyError
OCR engine does not have language data for the following req
Error message
OCR engine does not have language data for the following requested languages: \n{lang_text}\nPlease install the appropriate language data for your OCR engine.\n\nSee the online documentation for instructions:\n https://ocrmypdf.readthedocs.io/en/latest/languages.html\n\nNote: most languages are identified by a 3-letter ISO 639-2 Code.\nFor example, English is 'eng', German is 'deu', and Spanish is 'spa'.Simplified Chinese is 'chi_sim' and Traditional Chinese is 'chi_tra'.\n What it means
Raised when one or more requested OCR languages are not installed for the OCR engine (Tesseract). The message lists the missing codes and points to the language documentation.
Source
Thrown at src/ocrmypdf/_validation.py:86
missing_languages = set(options.languages) - set(ocr_engine_languages)
if missing_languages:
lang_text = '\n'.join(lang for lang in missing_languages)
msg = (
"OCR engine does not have language data for the following "
"requested languages: \n"
f"{lang_text}\n"
"Please install the appropriate language data for your OCR engine.\n"
"\n"
"See the online documentation for instructions:\n"
" https://ocrmypdf.readthedocs.io/en/latest/languages.html\n"
"\n"
"Note: most languages are identified by a 3-letter ISO 639-2 Code.\n"
"For example, English is 'eng', German is 'deu', and Spanish is 'spa'.\n"
"Simplified Chinese is 'chi_sim' and Traditional Chinese is 'chi_tra'."
"\n"
)
raise MissingDependencyError(msg)
def check_options_sidecar(options: OcrOptions) -> None:
if options.sidecar == '\0':
if options.output_file == '-':
raise BadArgsError("--sidecar filename needed when output file is stdout.")
elif options.output_file == os.devnull:
raise BadArgsError(
"--sidecar filename needed when output file is /dev/null or NUL."
)
elif not isinstance(options.output_file, str | Path):
# The '\0' sentinel is only ever set by the CLI, which always
# supplies output_file as a plain path - not a stream. If this
# somehow fires, the caller mixed a CLI-only sentinel with the
# stream-based API.
raise BadArgsError(
"--sidecar filename needed when output file is not a path."
)View on GitHub (pinned to 5074a0b0e1)
Solutions
- Install the missing language pack (Debian/Ubuntu: apt install tesseract-ocr-<code>; macOS: brew install tesseract-lang; Windows: download .traineddata from tessdata_fast)
- Verify available languages with tesseract --list-langs
- Fix the code: use 3-letter ISO 639-2 codes (deu not de, chi_sim not zh)
Example fix
# before ocrmypdf -l deu in.pdf out.pdf # missing # after (install first) # apt install tesseract-ocr-deu ocrmypdf -l deu in.pdf out.pdf
Defensive patterns
Strategy: validation
Validate before calling
import subprocess available = set(subprocess.run(['tesseract','--list-langs'], capture_output=True, text=True).stdout.split()[1:]) missing = set(requested_langs) - available if missing: install_or_abort(missing)
Try / catch
catch ocrmypdf.MissingDependencyError, print install command per code, fail fast
Prevention
- Pre-flight check tesseract --list-langs in Dockerfiles and batch scripts
- Use ISO 639-2 codes; keep a mapping table for user-facing language names
When it happens
Trigger: options.languages containing codes absent from the engine's available language set, e.g. -l deu when only eng tessdata is installed; raised as MissingDependencyError in check_options_languages.
Common situations: Fresh Tesseract installs without extra language packs; typo'd codes like 'de' instead of 'deu' or 'zh' instead of 'chi_sim'; missing chi_sim/chi_tra packs for Chinese.
Related errors
- The following languages are for Tesseract's internal use and
- --redo-ocr (or --mode redo) is not currently compatible with
- Since you specified `--output-type none`, the output file {s
- Input file is an image, but the resolution (DPI) is not cred
- Input file is an image, but has no resolution (DPI) in its m
AI-assisted analysis of ocrmypdf/OCRmyPDF@5074a0b0e1 (2026-08-27).
Data as JSON: /api/errors/86a8fc53c911dac8.
Report an issue: GitHub.