chroma-core/chroma · error · ValueError
The open_clip python package is not installed. Please instal
Error message
The open_clip python package is not installed. Please install it with `pip install open-clip-torch`. https://github.com/mlfoundations/open_clip
What it means
OpenCLIPEmbeddingFunction.__init__ does `import open_clip` and converts ImportError into ValueError pointing at `pip install open-clip-torch`. This EF embeds images and text into a shared vector space using mlfoundations' open_clip (default model ViT-B-32, checkpoint laion2b_s34b_b79k), so the package — and its heavy friends torch and pillow — must be installed before construction. The import is deferred so plain chromadb installs stay lightweight.
Source
Thrown at chromadb/utils/embedding_functions/open_clip_embedding_function.py:44
model_name: str = "ViT-B-32",
checkpoint: str = "laion2b_s34b_b79k",
device: Optional[str] = "cpu",
) -> None:
"""
Initialize the OpenCLIPEmbeddingFunction.
Args:
model_name (str, optional): The name of the model to use for embeddings.
Defaults to "ViT-B-32".
checkpoint (str, optional): The checkpoint to use for the model.
Defaults to "laion2b_s34b_b79k".
device (str, optional): The device to use for computation.
Defaults to "cpu".
"""
try:
import open_clip
except ImportError:
raise ValueError(
"The open_clip python package is not installed. Please install it with `pip install open-clip-torch`. https://github.com/mlfoundations/open_clip"
)
try:
self._torch = importlib.import_module("torch")
except ImportError:
raise ValueError(
"The torch python package is not installed. Please install it with `pip install torch`"
)
try:
self._PILImage = importlib.import_module("PIL.Image")
except ImportError:
raise ValueError(
"The PIL python package is not installed. Please install it with `pip install pillow`"
)
self.model_name = model_nameView on GitHub (pinned to aecdd12c8a)
Solutions
- pip install open-clip-torch (note the package name has hyphens; the import name is open_clip)
- Verify in the same interpreter: python -c "import open_clip; print(open_clip.__version__)"
- Add open-clip-torch, torch, and pillow to your lockfile together, since this EF requires all three
Example fix
// before fn = OpenCLIPEmbeddingFunction() # ValueError: open_clip not installed // after (shell) pip install open-clip-torch // then fn = OpenCLIPEmbeddingFunction()
Defensive patterns
Strategy: validation
Validate before calling
import importlib.util
missing = [m for m in ("open_clip", "torch", "PIL") if importlib.util.find_spec(m) is None]
if missing:
raise SystemExit(f"OpenCLIP EF needs: pip install open-clip-torch torch pillow (missing: {missing})")
fn = OpenCLIPEmbeddingFunction() Try / catch
try:
fn = OpenCLIPEmbeddingFunction()
except ValueError as e:
if "open_clip" in str(e):
raise SystemExit("Run: pip install open-clip-torch") from e
raise Prevention
- Install the trio (open-clip-torch, torch, pillow) together in the app environment
- Construct every EF your app uses during CI smoke tests
- Verify with python -c "import open_clip" in the deploy pipeline
When it happens
Trigger: Constructing OpenCLIPEmbeddingFunction() without `pip install open-clip-torch`; venv/interpreter mismatch (open-clip-torch installed for a different Python); installing `open_clip_torch` under a different name/scope (e.g. only in a notebook kernel's env, not the app's env).
Common situations: Prototyping in a notebook (where it works) then running a script in another env (where it doesn't); Docker images that exclude GPU/CV dependencies to slim down; CI caches that skip optional deps.
Related errors
- The torch python package is not installed. Please install it
- The PIL python package is not installed. Please install it w
- The ollama python package is not installed. Please install i
- The onnxruntime python package is not installed. Please inst
- The tokenizers python package is not installed. Please insta
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/50955b82eb1fe540.
Report an issue: GitHub.