zylon-ai/private-gpt · error · ImportError

VisionReaderFactory requires additional dependencies that ar

Error message

VisionReaderFactory requires additional dependencies that are not installed. dependencies are not installed.

What it means

Raised by VisionReaderFactory.create_reader when the lazily-imported VisionReader class (which needs vision/PDF-rendering dependencies such as Pillow and Ghostscript bindings) cannot be imported. The factory catches the ImportError and re-raises it via format_missing_dependency_message. Note the message string itself embeds 'dependencies are not installed.' so the final error text reads awkwardly ('...not installed. dependencies are not installed.') — cosmetic, but the cause is always a missing optional dependency group.

Source

Thrown at private_gpt/components/readers/factories/vision.py:15

from private_gpt.components.readers.base_reader import IngestionReader
from private_gpt.components.readers.factories.base import ReaderFactory
from private_gpt.utils.dependencies import format_missing_dependency_message


class VisionReaderFactory(ReaderFactory):
    def create_reader(self, extension: str | None = None) -> IngestionReader:
        del extension

        try:
            from private_gpt.components.readers.vision.vision_reader import (
                VisionReader,
            )
        except ImportError as e:
            raise ImportError(
                format_missing_dependency_message(
                    "VisionReaderFactory requires additional dependencies that are not installed. "
                )
            ) from e

        return VisionReader(
            reader_settings=self.settings.transformation.vision_documents
        )

View on GitHub (pinned to 4a030776a3)

Solutions

  1. Install the vision ingestion extra (e.g. `pip install -e '.[ingest-vision]'` — use the extra name printed by format_missing_dependency_message).
  2. Confirm the import works: `python -c "from private_gpt.components.readers.vision.vision_reader import VisionReader"`.
  3. Verify system-level prerequisites for the vision pipeline (Ghostscript binary, Pillow) are present.
  4. If vision ingestion is unwanted, disable the vision transformation settings so VisionReaderFactory is never selected for the file type.

Example fix

# before
factory = VisionReaderFactory(settings=settings)
reader = factory.create_reader(".pdf")  # ImportError: vision deps missing

# after
# shell: pip install -e '.[ingest-vision]'
reader = factory.create_reader(".pdf")  # ok
Defensive patterns

Strategy: validation

Validate before calling

def vision_reader_available() -> bool:
    try:
        from private_gpt.components.readers.vision.vision_reader import VisionReader  # noqa: F401
        return True
    except ImportError:
        return False

Try / catch

try:
    reader = factory.create_reader()
except ImportError as e:
    logger.error("Vision dependencies missing: %s", e)
    # fall back to a non-vision reader for this document
    reader = fallback_factory.create_reader()

Prevention

When it happens

Trigger: Any call to VisionReaderFactory.create_reader(...) (extension argument is ignored) in an environment where `from private_gpt.components.readers.vision.vision_reader import VisionReader` fails — typically when the vision/PDF ingestion extra is not installed.

Common situations: Ingesting PDFs/images with vision transformation enabled (settings.transformation.vision_documents) without installing the vision extras; minimal Docker images that omit optional reader deps; upgrading private-gpt where vision support moved behind a new extra.

Related errors


AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15). Data as JSON: /api/errors/ae46d158c8e89a6d. Report an issue: GitHub.