{"record":{"id":"216caa0d6e393269","repo":"docling-project/docling","slug":"the-odfdo-package-is-required-to-process-opendoc","errorCode":null,"errorMessage":"The 'odfdo' package is required to process OpenDocument files. Install it with `pip install 'docling-slim[format-opendocument]'`.","messagePattern":"The 'odfdo' package is required to process OpenDocument files\\. Install it with `pip install 'docling-slim\\[format-opendocument\\]'`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"docling/backend/opendocument_backend.py","lineNumber":161,"sourceCode":"        raise RuntimeError(\n            f\"OpenDocument backend could not load document with hash {document_hash}\"\n        ) from e\n\n\nclass _OdfBaseBackend(DeclarativeDocumentBackend):\n    \"\"\"Shared loading / validation logic for ODT, ODS and ODP backends.\"\"\"\n\n    _odf_type: str = \"\"  # \"text\", \"spreadsheet\" or \"presentation\"\n\n    @override\n    def __init__(\n        self,\n        in_doc: InputDocument,\n        path_or_stream: BytesIO | Path,\n        options: OdsBackendOptions | None = None,\n    ) -> None:\n        if not _ODFDO_AVAILABLE:\n            raise ImportError(_INSTALL_HINT) from _ODFDO_IMPORT_ERROR\n        super().__init__(in_doc, path_or_stream, options)\n        self.path_or_stream: BytesIO | Path = path_or_stream\n        self.valid: bool = False\n        self.odf_obj: OdfDocument = _load_odf_document(\n            path_or_stream, self.document_hash\n        )\n        if self._odf_type and self.odf_obj.get_type() != self._odf_type:\n            raise RuntimeError(\n                f\"Expected an OpenDocument {self._odf_type!r} but got \"\n                f\"{self.odf_obj.get_type()!r}\"\n            )\n        self.valid = True\n\n    @override\n    def is_valid(self) -> bool:\n        return self.valid\n\n    @override","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/backend/opendocument_backend.py#L143-L179","documentation":"ImportError raised by _OdfBaseBackend.__init__ when the odfdo dependency is not installed (_ODFDO_AVAILABLE is False at module import time). The slim docling install excludes ODF backends; the message names the exact extra to install.","triggerScenarios":"Passing an ODT/ODS/ODP InputFormat document to a docling-slim installation without the format-opendocument extra; __init__ raises before any file I/O happens.","commonSituations":"Minimal Docker images, docling-slim installs tuned for PDF-only pipelines, CI caches from before ODT support was needed.","solutions":["pip install 'docling-slim[format-opendocument]' or install the full 'docling' package.","Verify: python -c \"import odfdo\" succeeds after install.","Add the extra to requirements/Dockerfile and rebuild the image.","Alternatively pre-convert ODF files to another supported format if you cannot add dependencies."],"exampleFix":"# before\npip install docling-slim\n# -> ImportError: The 'odfdo' package is required...\n\n# after\npip install 'docling-slim[format-opendocument]'","handlingStrategy":"validation","validationCode":"try:\n    import odfdo\n    ODF_OK = True\nexcept ImportError:\n    ODF_OK = False\nassert ODF_OK, \"install 'docling-slim[format-opendocument]'\"","typeGuard":null,"tryCatchPattern":"try:\n    backend = OdtDocumentBackend(in_doc, path)\nexcept ImportError as e:\n    logger.error('missing extra: %s', e)\n    raise","preventionTips":["Install format extras for every ODF InputFormat you enable","Probe optional imports at service startup","Use the full 'docling' package when format needs are broad"],"tags":["dependency","install","odf","extras"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}