{"record":{"id":"ae46d158c8e89a6d","repo":"zylon-ai/private-gpt","slug":"visionreaderfactory-requires-additional-dependenci","errorCode":null,"errorMessage":"VisionReaderFactory requires additional dependencies that are not installed. dependencies are not installed.","messagePattern":"VisionReaderFactory requires additional dependencies that are not installed\\. dependencies are not installed\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/readers/factories/vision.py","lineNumber":15,"sourceCode":"from private_gpt.components.readers.base_reader import IngestionReader\nfrom private_gpt.components.readers.factories.base import ReaderFactory\nfrom private_gpt.utils.dependencies import format_missing_dependency_message\n\n\nclass VisionReaderFactory(ReaderFactory):\n    def create_reader(self, extension: str | None = None) -> IngestionReader:\n        del extension\n\n        try:\n            from private_gpt.components.readers.vision.vision_reader import (\n                VisionReader,\n            )\n        except ImportError as e:\n            raise ImportError(\n                format_missing_dependency_message(\n                    \"VisionReaderFactory requires additional dependencies that are not installed. \"\n                )\n            ) from e\n\n        return VisionReader(\n            reader_settings=self.settings.transformation.vision_documents\n        )\n","sourceCodeStart":1,"sourceCodeEnd":24,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/readers/factories/vision.py#L1-L24","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install the vision ingestion extra (e.g. `pip install -e '.[ingest-vision]'` — use the extra name printed by format_missing_dependency_message).","Confirm the import works: `python -c \"from private_gpt.components.readers.vision.vision_reader import VisionReader\"`.","Verify system-level prerequisites for the vision pipeline (Ghostscript binary, Pillow) are present.","If vision ingestion is unwanted, disable the vision transformation settings so VisionReaderFactory is never selected for the file type."],"exampleFix":"# before\nfactory = VisionReaderFactory(settings=settings)\nreader = factory.create_reader(\".pdf\")  # ImportError: vision deps missing\n\n# after\n# shell: pip install -e '.[ingest-vision]'\nreader = factory.create_reader(\".pdf\")  # ok","handlingStrategy":"validation","validationCode":"def vision_reader_available() -> bool:\n    try:\n        from private_gpt.components.readers.vision.vision_reader import VisionReader  # noqa: F401\n        return True\n    except ImportError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    reader = factory.create_reader()\nexcept ImportError as e:\n    logger.error(\"Vision dependencies missing: %s\", e)\n    # fall back to a non-vision reader for this document\n    reader = fallback_factory.create_reader()","preventionTips":["Install the vision extra wherever vision_documents transformation is enabled in settings.","Verify Pillow and the Ghostscript binary exist in the runtime image.","Gate vision ingestion on a capability check at startup rather than failing per file."],"tags":["dependencies","import","vision","ingestion","optional-extras"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}