{"record":{"id":"867667877ff0a901","repo":"docling-project/docling","slug":"easyocr-is-not-installed-please-install-it-via-p","errorCode":null,"errorMessage":"EasyOCR is not installed. Please install it via `pip install easyocr` to use this OCR engine. Alternatively, Docling has support for other OCR engines. See the documentation.","messagePattern":"EasyOCR is not installed\\. Please install it via `pip install easyocr` to use this OCR engine\\. Alternatively, Docling has support for other OCR engines\\. See the documentation\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"docling/models/stages/ocr/easyocr_model.py","lineNumber":98,"sourceCode":"        options: EasyOcrOptions,\n        accelerator_options: AcceleratorOptions,\n    ):\n        super().__init__(\n            enabled=enabled,\n            artifacts_path=artifacts_path,\n            options=options,\n            accelerator_options=accelerator_options,\n        )\n        self.options: EasyOcrOptions\n\n        # multiplier for 72 dpi; the default 3.0 == 216 dpi.\n        self.scale = self.options.scale\n\n        if self.enabled:\n            try:\n                import easyocr\n            except ImportError:\n                raise ImportError(\n                    \"EasyOCR is not installed. Please install it via `pip install easyocr` to use this OCR engine. \"\n                    \"Alternatively, Docling has support for other OCR engines. See the documentation.\"\n                )\n\n            if self.options.use_gpu is None:\n                device = decide_device(accelerator_options.device)\n                # Enable easyocr GPU if running on CUDA, MPS\n                use_gpu = any(\n                    device.startswith(x)\n                    for x in [\n                        AcceleratorDevice.CUDA.value,\n                        AcceleratorDevice.MPS.value,\n                    ]\n                )\n            else:\n                warnings.warn(\n                    \"Deprecated field. Better to set the `accelerator_options.device` in `pipeline_options`. \"\n                    \"When `use_gpu and accelerator_options.device == AcceleratorDevice.CUDA` the GPU is used \"","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/models/stages/ocr/easyocr_model.py#L80-L116","documentation":"The EasyOCR stage lazily imports easyocr inside __init__ when enabled. If the import fails, docling raises ImportError telling you to `pip install easyocr`, since easyocr is an optional dependency not bundled with docling core. The message also points to docling's other OCR engines as alternatives.","triggerScenarios":"Enabling EasyOcrOptions without easyocr installed: `pipelines_options.ocr_options = EasyOcrOptions(...)` in an environment that only has docling/docling-slim base dependencies.","commonSituations":"Installing docling-slim or docling without the OCR extra; a fresh virtualenv where the optional dependency was never added; CI images trimmed of optional packages.","solutions":["Install easyocr: `pip install easyocr` (or add it to your project dependencies / use the docling extra that includes it).","Alternatively switch to another OCR engine that is installed (Tesseract, RapidOCR, OcrMac on macOS) by changing ocr_options.","Verify with `python -c \"import easyocr\"` after installation."],"exampleFix":"# before\noptions = EasyOcrOptions()  # enabled, easyocr missing -> ImportError at pipeline build\n\n# after (terminal)\npip install easyocr\n# or switch engine\nfrom docling.models.stages.ocr.tesseract_ocr_model import TesseractOcrOptions\npipeline_options.ocr_options = TesseractOcrOptions()","handlingStrategy":"validation","validationCode":"try:\n    import easyocr  # noqa: F401\n    easyocr_available = True\nexcept ImportError:\n    easyocr_available = False\n\noptions = EasyOcrOptions() if easyocr_available else TesseractOcrOptions()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare easyocr in your project dependencies when the pipeline uses it.","Gate OCR engine choice on import availability the way docling core does.","Include optional OCR extras in Dockerfiles/CI environments to avoid runtime surprises."],"tags":["easyocr","ocr","import","dependencies"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}