docling-project/docling · error · ImportError
The 'odfdo' package is required to process OpenDocument file
Error message
The 'odfdo' package is required to process OpenDocument files. Install it with `pip install 'docling-slim[format-opendocument]'`.
What it means
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.
Source
Thrown at docling/backend/opendocument_backend.py:161
raise RuntimeError(
f"OpenDocument backend could not load document with hash {document_hash}"
) from e
class _OdfBaseBackend(DeclarativeDocumentBackend):
"""Shared loading / validation logic for ODT, ODS and ODP backends."""
_odf_type: str = "" # "text", "spreadsheet" or "presentation"
@override
def __init__(
self,
in_doc: InputDocument,
path_or_stream: BytesIO | Path,
options: OdsBackendOptions | None = None,
) -> None:
if not _ODFDO_AVAILABLE:
raise ImportError(_INSTALL_HINT) from _ODFDO_IMPORT_ERROR
super().__init__(in_doc, path_or_stream, options)
self.path_or_stream: BytesIO | Path = path_or_stream
self.valid: bool = False
self.odf_obj: OdfDocument = _load_odf_document(
path_or_stream, self.document_hash
)
if self._odf_type and self.odf_obj.get_type() != self._odf_type:
raise RuntimeError(
f"Expected an OpenDocument {self._odf_type!r} but got "
f"{self.odf_obj.get_type()!r}"
)
self.valid = True
@override
def is_valid(self) -> bool:
return self.valid
@overrideView on GitHub (pinned to 61d76f1ff3)
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.
Example fix
# before pip install docling-slim # -> ImportError: The 'odfdo' package is required... # after pip install 'docling-slim[format-opendocument]'
Defensive patterns
Strategy: validation
Validate before calling
try:
import odfdo
ODF_OK = True
except ImportError:
ODF_OK = False
assert ODF_OK, "install 'docling-slim[format-opendocument]'" Try / catch
try:
backend = OdtDocumentBackend(in_doc, path)
except ImportError as e:
logger.error('missing extra: %s', e)
raise Prevention
- 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
When it happens
Trigger: 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.
Common situations: Minimal Docker images, docling-slim installs tuned for PDF-only pipelines, CI caches from before ODT support was needed.
Related errors
- The 'python-docx' package is required to process Word files.
- Libreoffice not found
- LibreOffice is required to convert a .{source_suffix} file t
- The 'openpyxl' package is required to process Excel files. I
- The 'python-pptx' package is required to process PowerPoint
AI-assisted analysis of docling-project/docling@61d76f1ff3 (2026-08-14).
Data as JSON: /api/errors/216caa0d6e393269.
Report an issue: GitHub.