docling-project/docling · error · ImportError
The 'python-pptx' package is required to process PowerPoint
Error message
The 'python-pptx' package is required to process PowerPoint files. Install it with `pip install 'docling-slim[format-pptx]'`.
What it means
ImportError raised by MsPowerpointDocumentBackend.__init__ when the optional dependency python-pptx is unavailable. Like the Excel backend, the PowerPoint support in docling-slim is opt-in via an extra, and the error message names the exact extra to install. The original import error is chained so the environment problem is traceable.
Source
Thrown at docling/backend/mspowerpoint_backend.py:144
"""
# XML relationship types
COMMENT_REL = (
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"
)
COMMENT_AUTHORS_REL = (
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/"
"commentAuthors"
)
def __init__(
self,
in_doc: InputDocument,
path_or_stream: Union[BytesIO, Path],
options: Optional[MsPowerpointBackendOptions] = None,
) -> None:
if not _PPTX_AVAILABLE:
raise ImportError(_INSTALL_HINT) from _PPTX_IMPORT_ERROR
if in_doc.format == InputFormat.PPT:
path_or_stream = convert_to_modern_format(path_or_stream, "ppt", "pptx")
if options is None:
options = MsPowerpointBackendOptions()
super().__init__(in_doc, path_or_stream, options)
self.path_or_stream: Union[BytesIO, Path] = path_or_stream
self.page_range = in_doc.limits.page_range
self.pptx_to_pdf_converter: Optional[Callable] = None
self.pptx_to_pdf_converter_init: bool = False
self._render_charts: bool = False
self.pptx_obj: Optional[presentation.Presentation] = None
self.valid: bool = False
try:
if isinstance(self.path_or_stream, BytesIO):
self.pptx_obj = Presentation(self.path_or_stream)
elif isinstance(self.path_or_stream, Path):View on GitHub (pinned to 61d76f1ff3)
Solutions
- Install the extra: `pip install 'docling-slim[format-pptx]'` (equivalently `pip install python-pptx`).
- Or install full `docling` which pulls format dependencies.
- Pre-flight check: `python -c 'import pptx'` in deployment smoke tests.
- For legacy .ppt also ensure LibreOffice (soffice) is installed.
Example fix
# before
pip install docling-slim
DocumentConverter().convert('deck.pptx') # ImportError
# after
pip install 'docling-slim[format-pptx]'
DocumentConverter().convert('deck.pptx') Defensive patterns
Strategy: validation
Validate before calling
def pptx_support_available() -> bool:
try:
import pptx # noqa: F401
return True
except ImportError:
return False
if not pptx_support_available():
raise SystemExit("pip install 'docling-slim[format-pptx]'") Try / catch
try:
result = converter.convert(pptx_path)
except ImportError as e:
if 'python-pptx' in str(e):
raise SystemExit("Missing dependency: pip install 'docling-slim[format-pptx]'") from e
raise Prevention
- Install the format-pptx extra wherever decks are converted.
- Smoke-test `import pptx` in CI/deployment images.
- For legacy .ppt, also ensure LibreOffice is present.
When it happens
Trigger: Converting .pptx files while running docling-slim without the format-pptx extra; also .ppt legacy files, since they are pre-converted to .pptx (via soffice) and then still require python-pptx to parse.
Common situations: Slim Docker/CI installs, picking docling-slim to avoid heavy ML dependencies, or environments where python-pptx was pruned by a dependency resolver. Missing LibreOffice for .ppt input produces a different failure but this one hits first if python-pptx is absent.
Related errors
- The 'openpyxl' package is required to process Excel files. I
- Libreoffice not found
- LibreOffice is required to convert a .{source_suffix} file t
- MsPowerpointDocumentBackend could not load document with has
- The 'python-docx' package is required to process Word files.
AI-assisted analysis of docling-project/docling@61d76f1ff3 (2026-08-14).
Data as JSON: /api/errors/623020dd6fd18878.
Report an issue: GitHub.