{"record":{"id":"4ff5bab8797c220e","repo":"docling-project/docling","slug":"ocrmac-is-not-correctly-installed-please-install","errorCode":null,"errorMessage":"ocrmac is not correctly installed. Please install it via `pip install ocrmac` to use this OCR engine. Alternatively, Docling has support for other OCR engines. See the documentation: https://docling-project.github.io/docling/installation/","messagePattern":"ocrmac is not correctly installed\\. Please install it via `pip install ocrmac` to use this OCR engine\\. Alternatively, Docling has support for other OCR engines\\. See the documentation: https://docling-project\\.github\\.io/docling/installation/","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"docling/models/stages/ocr/ocr_mac_model.py","lineNumber":56,"sourceCode":"        )\n        self.options: OcrMacOptions\n\n        # multiplier for 72 dpi; the default 3.0 == 216 dpi.\n        self.scale = self.options.scale\n\n        if self.enabled:\n            if \"darwin\" != sys.platform:\n                raise RuntimeError(\"OcrMac is only supported on Mac.\")\n            install_errmsg = (\n                \"ocrmac is not correctly installed. \"\n                \"Please install it via `pip install ocrmac` to use this OCR engine. \"\n                \"Alternatively, Docling has support for other OCR engines. See the documentation: \"\n                \"https://docling-project.github.io/docling/installation/\"\n            )\n            try:\n                from ocrmac import ocrmac\n            except ImportError:\n                raise ImportError(install_errmsg)\n\n            self.reader_RIL = ocrmac.OCR\n\n    def __call__(\n        self, conv_res: ConversionResult, page_batch: Iterable[Page]\n    ) -> Iterable[Page]:\n        if not self.enabled:\n            yield from page_batch\n            return\n\n        for page in page_batch:\n            assert page._backend is not None\n            if not page._backend.is_valid():\n                yield page\n            else:\n                with TimeRecorder(conv_res, \"ocr\"):\n                    ocr_rects = self.get_ocr_rects(page)\n","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/models/stages/ocr/ocr_mac_model.py#L38-L74","documentation":"On macOS with the engine enabled, docling lazily imports ocrmac; ImportError is raised with install instructions when the package is missing, since ocrmac is an optional dependency. The message links to docling's installation docs and mentions other OCR engines as alternatives.","triggerScenarios":"Setting ocr_options = OcrMacOptions() on macOS in an environment that installed docling without the ocrmac package.","commonSituations":"Base `pip install docling` (no OCR extras) on a Mac; a fresh virtualenv; ocrmac removed during dependency pruning.","solutions":["Run `pip install ocrmac` on the macOS host.","Or switch to another installed OCR engine (Tesseract, EasyOCR, RapidOCR) via pipeline_options.ocr_options.","Verify with `python -c \"from ocrmac import ocrmac\"`."],"exampleFix":"# before\npipeline_options.ocr_options = OcrMacOptions()  # macOS, ocrmac missing -> ImportError\n\n# after (terminal)\npip install ocrmac\npython -c \"from ocrmac import ocrmac; print('ok')\"","handlingStrategy":"validation","validationCode":"try:\n    from ocrmac import ocrmac  # noqa: F401\n    ocrmac_available = True\nexcept ImportError:\n    ocrmac_available = False\n\noptions = OcrMacOptions() if sys.platform == \"darwin\" and ocrmac_available else TesseractOcrOptions()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add ocrmac to your dependency set on macOS builds.","Probe imports for optional engines before selecting one.","Include optional OCR deps in the macOS CI environment to catch missing packages early."],"tags":["ocrmac","ocr","import","dependencies","macos"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}