{"record":{"id":"e55b5b0608e3387b","repo":"chroma-core/chroma","slug":"the-httpx-python-package-is-not-installed-please","errorCode":null,"errorMessage":"The httpx python package is not installed. Please install it with `pip install httpx`","messagePattern":"The httpx python package is not installed\\. Please install it with `pip install httpx`","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"chromadb/utils/embedding_functions/chroma_cloud_qwen_embedding_function.py","lineNumber":55,"sourceCode":"        instructions: ChromaCloudQwenEmbeddingInstructions = CHROMA_CLOUD_QWEN_DEFAULT_INSTRUCTIONS,\n        api_key_env_var: str = \"CHROMA_API_KEY\",\n    ):\n        \"\"\"\n        Initialize the ChromaCloudQwenEmbeddingFunction.\n\n        Args:\n            model (ChromaCloudQwenEmbeddingModel): The specific Qwen model to use for embeddings.\n            task (str, optional): The task for which embeddings are being generated. If None or empty,\n                empty instructions will be used for both documents and queries.\n            instructions (ChromaCloudQwenEmbeddingInstructions, optional): A dictionary containing\n                custom instructions to use for the specified Qwen model. Defaults to CHROMA_CLOUD_QWEN_DEFAULT_INSTRUCTIONS.\n            api_key_env_var (str, optional): Environment variable name that contains your API key.\n                Defaults to \"CHROMA_API_KEY\".\n        \"\"\"\n        try:\n            import httpx\n        except ImportError:\n            raise ValueError(\n                \"The httpx python package is not installed. Please install it with `pip install httpx`\"\n            )\n\n        self.api_key_env_var = api_key_env_var\n        # First, try to get API key from environment variable\n        self.api_key = os.getenv(api_key_env_var)\n        # If not found in env var, try to get it from existing client instances\n        if not self.api_key:\n            SharedSystemClient = _get_shared_system_client()\n            self.api_key = SharedSystemClient.get_chroma_cloud_api_key_from_clients()\n        # Raise error if still no API key found\n        if not self.api_key:\n            raise ValueError(\n                f\"API key not found in environment variable {api_key_env_var} \"\n                f\"or in any existing client instances\"\n            )\n\n        self.model = model","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/utils/embedding_functions/chroma_cloud_qwen_embedding_function.py#L37-L73","documentation":"The constructor of ChromaCloudQwenEmbeddingFunction (the Qwen dense embedding client for Chroma Cloud) does `import httpx` and raises ValueError on ImportError. httpx is the HTTP client this function uses for all requests to the Chroma Embed API, and it is an optional dependency not bundled with the base chromadb install.","triggerScenarios":"Instantiating ChromaCloudQwenEmbeddingFunction(model=ChromaCloudQwenEmbeddingModel.QWEN3_EMBEDDING_0p6B, task=...) in an environment where httpx is not installed (module resolution fails at the `import httpx` inside __init__).","commonSituations":"Fresh virtualenv with chromadb but without optional extras; Docker/CI slim images that strip optional deps; a different interpreter than the one where httpx was pip-installed.","solutions":["pip install httpx in the same environment running your app.","Add httpx to requirements.txt / pyproject.toml dependencies for any deployment using Chroma Cloud embedding functions.","If it should already be installed, verify with `python -c \"import httpx\"` in the exact interpreter/venv, and check for a conflicting local httpx.py file shadowing the package."],"exampleFix":"# before\nfrom chromadb.utils.embedding_functions import ChromaCloudQwenEmbeddingFunction\nef = ChromaCloudQwenEmbeddingFunction(...)  # ValueError: httpx not installed\n\n# after (pip install httpx)\nef = ChromaCloudQwenEmbeddingFunction(model=ChromaCloudQwenEmbeddingModel.QWEN3_EMBEDDING_0p6B, task=\"nl_to_code\")","handlingStrategy":"validation","validationCode":"import importlib.util\n\nif importlib.util.find_spec(\"httpx\") is None:\n    raise SystemExit(\"httpx is required for ChromaCloudQwenEmbeddingFunction: pip install httpx\")\nef = ChromaCloudQwenEmbeddingFunction(model=ChromaCloudQwenEmbeddingModel.QWEN3_EMBEDDING_0p6B, task=None)","typeGuard":null,"tryCatchPattern":"try:\n    ef = ChromaCloudQwenEmbeddingFunction(...)\nexcept ValueError as e:\n    if \"httpx\" in str(e):\n        subprocess.run([sys.executable, \"-m\", \"pip\", \"install\", \"httpx\"], check=True)\n        ef = ChromaCloudQwenEmbeddingFunction(...)  # retry once after install\n    else:\n        raise","preventionTips":["Declare httpx in project dependencies wherever cloud embedding functions are used.","Add a startup dependency check (find_spec) so failures happen at boot, not mid-ingestion.","Pin httpx to avoid surprise breaking major versions."],"tags":["httpx","missing-dependency","chroma-cloud","qwen","python"],"backgroundTag":"missing-python-package","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}