{"record":{"id":"6f6ad06ea76135a0","repo":"docling-project/docling","slug":"tesserocr-is-not-correctly-configured-no-language","errorCode":null,"errorMessage":"tesserocr is not correctly configured. No language models have been detected. Please ensure that the TESSDATA_PREFIX envvar points to tesseract languages dir. You can find more information how to setup other OCR engines in Docling documentation: https://docling-project.github.io/docling/installation/","messagePattern":"tesserocr is not correctly configured\\. No language models have been detected\\. Please ensure that the TESSDATA_PREFIX envvar points to tesseract languages dir\\. You can find more information how to setup other OCR engines in Docling documentation: https://docling-project\\.github\\.io/docling/installation/","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"docling/models/stages/ocr/tesseract_ocr_model.py","lineNumber":78,"sourceCode":"                \"tesserocr is not correctly configured. No language models have been detected. \"\n                \"Please ensure that the TESSDATA_PREFIX envvar points to tesseract languages dir. \"\n                \"You can find more information how to setup other OCR engines in Docling \"\n                \"documentation: \"\n                \"https://docling-project.github.io/docling/installation/\"\n            )\n\n            try:\n                import tesserocr\n            except ImportError:\n                raise ImportError(install_errmsg)\n            try:\n                tesseract_version = tesserocr.tesseract_version()\n            except Exception:\n                raise ImportError(install_errmsg)\n\n            _, self._tesserocr_languages = tesserocr.get_languages()\n            if not self._tesserocr_languages:\n                raise ImportError(missing_langs_errmsg)\n\n            # Initialize the tesseractAPI\n            _log.debug(\"Initializing TesserOCR: %s\", tesseract_version)\n            lang = \"+\".join(self.options.lang)\n\n            if any(lang.startswith(\"script/\") for lang in self._tesserocr_languages):\n                self.script_prefix = \"script/\"\n            else:\n                self.script_prefix = \"\"\n\n            tesserocr_kwargs = {\n                \"init\": True,\n                \"oem\": tesserocr.OEM.DEFAULT,\n            }\n\n            self.osd_reader = None\n\n            if self.options.path is not None:","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/models/stages/ocr/tesseract_ocr_model.py#L60-L96","documentation":"tesserocr.get_languages() returns the list of language models found on the system. If it comes back empty, Docling raises this ImportError: no tessdata files are discoverable, so OCR would fail for every language. The fix is to point TESSDATA_PREFIX at a directory containing *.traineddata files.","triggerScenarios":"Tesseract installed without any language packs, or the tessdata directory is not where tesserocr looks — TESSDATA_PREFIX unset/wrong while the default search path has no traineddata files.","commonSituations":"Minimal Docker images that install tesseract-ocr but not tesseract-ocr-eng; custom Tesseract builds installed to /usr/local without copying tessdata; envvar typos in deployment manifests.","solutions":["Install at least one language pack: apt-get install tesseract-ocr-eng (or the languages you need).","Set TESSDATA_PREFIX to the directory containing *.traineddata, e.g. /usr/share/tesseract-ocr/4.00/tessdata or /usr/local/share/tessdata.","Verify with 'ls $TESSDATA_PREFIX/*.traineddata' in the same environment your app runs in."],"exampleFix":"# before\n# ImportError: No language models have been detected\n\n# after\n$ apt-get install -y tesseract-ocr-eng\n$ export TESSDATA_PREFIX=/usr/share/tesseract-ocr/4.00/tessdata","handlingStrategy":"validation","validationCode":"import tesserocr\n\n_, langs = tesserocr.get_languages()\nif not langs:\n    raise SystemExit(\n        \"no tessdata found — install language packs and set TESSDATA_PREFIX\"\n    )","typeGuard":null,"tryCatchPattern":"try:\n    TesseractOcrModel(options=TesseractOcrOptions())\nexcept ImportError as e:\n    if \"No language models have been detected\" in str(e):\n        os.environ[\"TESSDATA_PREFIX\"] = \"/usr/share/tesseract-ocr/4.00/tessdata\"\n        TesseractOcrModel(options=TesseractOcrOptions())  # retry once\n    else:\n        raise","preventionTips":["Install at least one tesseract-ocr-<lang> package alongside the binary in images.","Set and verify TESSDATA_PREFIX in deployment manifests.","Add a startup check listing *.traineddata in the configured tessdata dir."],"tags":["ocr","tesseract","tessdata","environment"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}