{"record":{"id":"a7974d82c2fb6107","repo":"headroomlabs-ai/headroom","slug":"qdrant-client-not-installed-install-with-pip-ins","errorCode":null,"errorMessage":"qdrant-client not installed. Install with: pip install qdrant-client","messagePattern":"qdrant-client not installed\\. Install with: pip install qdrant-client","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"headroom/memory/backends/direct_mem0.py","lineNumber":196,"sourceCode":"                \"openai package not installed. Install with: pip install openai\"\n            ) from None\n\n        # Initialize Qdrant client for direct writes\n        try:\n            from qdrant_client import QdrantClient\n\n            client_kwargs = qdrant_env.build_qdrant_client_kwargs(\n                url=self._config.qdrant_url,\n                host=self._config.qdrant_host,\n                port=self._config.qdrant_port,\n                api_key=self._config.qdrant_api_key,\n                https=self._config.qdrant_https,\n                prefer_grpc=self._config.qdrant_prefer_grpc,\n                grpc_port=self._config.qdrant_grpc_port,\n            )\n            self._qdrant_client = QdrantClient(**client_kwargs)\n        except ImportError:\n            raise ImportError(\n                \"qdrant-client not installed. Install with: pip install qdrant-client\"\n            ) from None\n\n        # Initialize Neo4j for direct graph writes (if enabled)\n        if self._config.enable_graph:\n            try:\n                from neo4j import GraphDatabase\n\n                self._neo4j_driver = GraphDatabase.driver(\n                    self._config.neo4j_uri,\n                    auth=(self._config.neo4j_user, self._config.neo4j_password),\n                )\n            except ImportError:\n                logger.warning(\"neo4j driver not installed. Graph features disabled.\")\n                self._neo4j_driver = None\n\n        # Initialize Mem0 client for fallback path\n        try:","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/headroomlabs-ai/headroom/blob/322425c43bffde1ed0b64fecf3cf5951565dd82b/headroom/memory/backends/direct_mem0.py#L178-L214","documentation":"Raised by DirectMem0Adapter._ensure_initialized() when 'qdrant_client' cannot be imported. The direct-mem0 backend writes vectors straight to a Qdrant instance, so qdrant-client is mandatory. It fires on the first memory operation, after the openai import succeeded but before the Neo4j/graph stage.","triggerScenarios":"First async call on DirectMem0Adapter (save/search/delete/etc.) with openai installed but qdrant-client missing; the try block around 'from qdrant_client import QdrantClient' plus QdrantClient(**kwargs) catches only ImportError and re-raises it with this message.","commonSituations":"Partial installs where openai was added manually but the memory-stack extra was skipped; slim Docker images that strip optional deps; dependency resolver conflicts downgrading/removing qdrant-client.","solutions":["pip install 'headroom-ai[memory-stack]'","Or install directly: pip install qdrant-client","Confirm the package is importable in the running interpreter: python -c 'from qdrant_client import QdrantClient'","If you do not need vector search, use the local sqlite backend instead"],"exampleFix":"# before\npip install openai  # only openai installed\nawait adapter.search('query')  # ImportError: qdrant-client not installed\n\n# after\npip install 'headroom-ai[memory-stack]'\nawait adapter.search('query')","handlingStrategy":"validation","validationCode":"import importlib.util\n\ndef qdrant_client_available() -> bool:\n    return importlib.util.find_spec('qdrant_client') is not None\n\nassert qdrant_client_available(), 'pip install \"headroom-ai[memory-stack]\"'","typeGuard":null,"tryCatchPattern":"try:\n    await backend.search('query')\nexcept ImportError as e:\n    if 'qdrant-client not installed' in str(e):\n        logger.error('missing qdrant-client; install memory-stack extra')\n    raise","preventionTips":["Use the [memory-stack] extra rather than installing pieces manually","Add a smoke test in CI that instantiates the backend and performs one write/read","Keep the app venv explicit in deployment (uv/poetry lockfiles) to avoid partial installs"],"tags":["python","import","dependency","qdrant","mem0","memory-backend"],"backgroundTag":null,"analyzedSha":"322425c43bffde1ed0b64fecf3cf5951565dd82b","analyzedAt":"2026-08-15T01:03:05.481Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}