{"record":{"id":"b3db2206602ca2d7","repo":"chroma-core/chroma","slug":"the-httpx-python-package-is-not-installed-please-b3db22","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/jina_embedding_function.py","lineNumber":67,"sourceCode":"                Defaults to \"jina-embeddings-v2-base-en\".\n            task (str, optional): The task to use for the Jina AI API.\n                Defaults to None.\n            late_chunking (bool, optional): Whether to use late chunking for the Jina AI API.\n                Defaults to None.\n            truncate (bool, optional): Whether to truncate the Jina AI API.\n                Defaults to None.\n            dimensions (int, optional): The number of dimensions to use for the Jina AI API.\n                Defaults to None.\n            embedding_type (str, optional): The type of embedding to use for the Jina AI API.\n                Defaults to None.\n            normalized (bool, optional): Whether to normalize the Jina AI API.\n                Defaults to None.\n\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        try:\n            self._PILImage = importlib.import_module(\"PIL.Image\")\n        except ImportError:\n            raise ValueError(\n                \"The PIL python package is not installed. Please install it with `pip install pillow`\"\n            )\n\n        if api_key is not None:\n            warnings.warn(\n                \"Direct api_key configuration will not be persisted. \"\n                \"Please use environment variables via api_key_env_var for persistent storage.\",\n                DeprecationWarning,\n            )\n\n        if os.getenv(\"JINA_API_KEY\") is not None:\n            self.api_key_env_var = \"JINA_API_KEY\"","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/chromadb/utils/embedding_functions/jina_embedding_function.py#L49-L85","documentation":"JinaEmbeddingFunction talks to https://api.jina.ai/v1/embeddings over HTTP using the httpx client, which it imports lazily in __init__. chromadb does not depend on httpx unconditionally, so if httpx is not installed the ImportError becomes this ValueError at construction. Note the constructor imports both httpx and PIL.Image — either missing aborts initialization.","triggerScenarios":"JinaEmbeddingFunction(model_name='jina-clip-v1') in an environment without httpx (e.g. minimal chromadb install, pruned container image); dependency resolver removing httpx after a pip-sync; fresh venv created from a lockfile that omits it.","commonSituations":"Slim Docker images that only install chromadb; CI caching stale environments; local dev installing chromadb with minimal extras then switching from a requests-based EF to the Jina EF.","solutions":["pip install httpx in the interpreter running chromadb","Verify: python -c \"import httpx; print(httpx.__version__)\"","Add httpx explicitly to requirements.txt so lock/prune tools do not drop it"],"exampleFix":"# before\nfrom chromadb.utils.embedding_functions import JinaEmbeddingFunction\nef = JinaEmbeddingFunction(model_name=\"jina-clip-v1\")  # ValueError: httpx missing\n\n# after\n# pip install httpx\nimport importlib.util\nif importlib.util.find_spec(\"httpx\") is None:\n    raise SystemExit(\"pip install httpx\")\nef = JinaEmbeddingFunction(model_name=\"jina-clip-v1\")","handlingStrategy":"validation","validationCode":"import importlib.util\n\nif importlib.util.find_spec(\"httpx\") is None:\n    raise SystemExit(\"Jina EF needs httpx: pip install httpx\")\n\nfrom chromadb.utils.embedding_functions import JinaEmbeddingFunction\nef = JinaEmbeddingFunction(model_name=\"jina-clip-v1\")","typeGuard":null,"tryCatchPattern":"try:\n    ef = JinaEmbeddingFunction(model_name=\"jina-clip-v1\")\nexcept ValueError as e:\n    if \"httpx\" in str(e):\n        raise RuntimeError(\"pip install httpx\") from e\n    raise","preventionTips":["Declare httpx explicitly next to chromadb in requirements (don't rely on transitive presence)","Include a find_spec-based dependency preflight for every HTTP-based EF you enable","Re-run dependency checks after pip-sync/uv-sync pruning steps"],"tags":["python","dependency","pip","httpx","jina","optional-import"],"backgroundTag":"missing-optional-dependency","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}