{"record":{"id":"da60ae2ba48fd336","repo":"zylon-ai/private-gpt","slug":"postgres-node-store-dependencies-are-not-installed","errorCode":null,"errorMessage":"Postgres node store dependencies are not installed. Install with `uv sync --inexact --extra nodestore-postgres`.","messagePattern":"Postgres node store dependencies are not installed\\. Install with `uv sync --inexact --extra nodestore-postgres`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/node_store/node_store_component.py","lineNumber":51,"sourceCode":"        return SimpleIndexStore.from_persist_dir(\n            persist_dir=str(local_data_path / collection)\n        )\n    except FileNotFoundError:\n        logger.debug(\"Local index store not found, creating a new one\")\n        return SimpleIndexStore()\n\n\ndef _postgres_index_store(settings: Settings, collection: str) -> BaseIndexStore:\n    try:\n        from llama_index.storage.index_store.postgres import (  # ty:ignore[unresolved-import]\n            PostgresIndexStore,\n        )\n\n        from private_gpt.components.node_store.patched_postgres_kv_store import (\n            PatchedPostgresKVStore,\n        )\n    except ImportError as e:\n        raise ImportError(\n            format_missing_dependency_message(\n                \"Postgres node store\",\n                extras=\"nodestore-postgres\",\n            )\n        ) from e\n\n    from private_gpt.components.postgres.postgres_client import LazyPostgresFactory\n\n    client = LazyPostgresFactory.get_instance(settings)\n    kv_store = PatchedPostgresKVStore(\n        client.sync_session,\n        client.async_session,\n        table_name=collection,\n        schema_name=\"zgptnode\",\n    )\n    return typing.cast(BaseIndexStore, PostgresIndexStore(kv_store))\n\n","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/node_store/node_store_component.py#L33-L69","documentation":"Import-time guard in `_postgres_index_store`: the `PostgresIndexStore` / patched KV store imports are wrapped in try/except ImportError, and on failure it raises ImportError with a formatted install hint naming the `nodestore-postgres` extra. It means the Python environment lacks the optional Postgres storage dependencies (psycopg2, sqlalchemy, llama-index postgres storage).","triggerScenarios":"Setting `node_store.index_store` to a Postgres-backed provider while the package was installed without the `nodestore-postgres` extra; deploying with a trimmed dependency set; CI environments using `--no-deps` or minimal extras.","commonSituations":"Fresh deploy where settings.yaml enables postgres node store but requirements only include core deps; Docker images built with only default extras; upgrading and switching from simple/none store to postgres without re-syncing env.","solutions":["Install the extra exactly as the message says: `uv sync --inexact --extra nodestore-postgres`","Or switch `node_store.index_store` back to a provider whose deps are installed (e.g. simple) if Postgres was unintended","Rebuild the deployment image including the extra"],"exampleFix":"# before\nuv sync --inexact\n# node_store.index_store: postgres -> ImportError\n\n# after\nuv sync --inexact --extra nodestore-postgres","handlingStrategy":"validation","validationCode":"from importlib.util import find_spec\n\nmissing = [m for m in (\"psycopg2\", \"sqlalchemy\") if find_spec(m) is None]\nif missing and settings.node_store.index_store == \"postgres\":\n    raise SystemExit(\"Run: uv sync --inexact --extra nodestore-postgres\")","typeGuard":null,"tryCatchPattern":"try:\n    store = node_store.index_store(collection)\nexcept ImportError as e:\n    if \"nodestore-postgres\" in str(e):\n        raise SystemExit(str(e))  # fail fast with the install command\n    raise","preventionTips":["Encode required extras in deployment scripts/Dockerfile next to the settings that need them","Add a startup preflight that checks find_spec for every optional dep implied by settings"],"tags":["dependency","optional-extra","postgres","node-store","packaging"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}