chroma-core/chroma · error · ValueError
The ollama python package is not installed. Please install i
Error message
The ollama python package is not installed. Please install it with `pip install ollama`
What it means
OllamaEmbeddingFunction.__init__ does `from ollama import Client` inside a try/except ImportError and converts a missing package into a ValueError with install instructions. The import is deferred to construction so that importing chromadb itself never requires ollama; only users who actually instantiate this EF need the dependency. The default target is a local Ollama server at http://localhost:11434 with model chroma/all-minilm-l6-v2-f32.
Source
Thrown at chromadb/utils/embedding_functions/ollama_embedding_function.py:34
def __init__(
self,
url: str = "http://localhost:11434",
model_name: str = DEFAULT_MODEL_NAME,
timeout: int = 60,
) -> None:
"""
Initialize the Ollama Embedding Function.
Args:
url (str): The Base URL of the Ollama Server (default: "http://localhost:11434").
model_name (str): The name of the model to use for text embeddings.
Defaults to "chroma/all-minilm-l6-v2-f32", for available models see https://ollama.com/library.
timeout (int): The timeout for the API call in seconds. Defaults to 60.
"""
try:
from ollama import Client
except ImportError:
raise ValueError(
"The ollama python package is not installed. Please install it with `pip install ollama`"
)
self.url = url
self.model_name = model_name
self.timeout = timeout
# Adding this for backwards compatibility with the old version of the EF
self._base_url = url
if self._base_url.endswith("/api/embeddings"):
parsed_url = urlparse(url)
self._base_url = f"{parsed_url.scheme}://{parsed_url.netloc}"
self._client = Client(host=self._base_url, timeout=timeout)
def __call__(self, input: Documents) -> Embeddings:
"""
Get the embeddings for a list of texts.View on GitHub (pinned to aecdd12c8a)
Solutions
- pip install ollama into the same interpreter/venv that runs Chroma (verify with `python -m pip show ollama`)
- Add ollama to requirements.txt/pyproject next to chromadb for reproducible environments
- If you intentionally run without Ollama, pick a different EF (e.g. DefaultEmbeddingFunction) instead of this one
Example fix
// before fn = OllamaEmbeddingFunction(url="http://localhost:11434", model_name="nomic-embed-text") # ValueError: package not installed // after (shell) pip install ollama // then fn = OllamaEmbeddingFunction(url="http://localhost:11434", model_name="nomic-embed-text")
Defensive patterns
Strategy: validation
Validate before calling
import importlib.util
if importlib.util.find_spec("ollama") is None:
raise SystemExit("ollama package missing: pip install ollama")
fn = OllamaEmbeddingFunction(url="http://localhost:11434", model_name="nomic-embed-text") Try / catch
try:
fn = OllamaEmbeddingFunction(url=..., model_name=...)
except ValueError as e:
if "not installed" in str(e):
raise SystemExit("Run: pip install ollama") from e
raise Prevention
- Pin optional EF deps (ollama) in the same lockfile as chromadb
- Run dependency smoke tests in CI that construct every EF you use
- Use one interpreter/venv consistently; verify with python -m pip show ollama
When it happens
Trigger: Constructing OllamaEmbeddingFunction(url=..., model_name=...) in an environment where `pip install ollama` was never run; a venv mismatch where ollama was installed into a different interpreter than the one running Chroma; a fresh clone/CI image that only installs chromadb.
Common situations: Local-dev-vs-CI dependency drift (ollama installed on the laptop, not in the Docker image); mixing system Python and a project venv; upgrading Chroma in an environment whose requirements.txt pins only chromadb.
Related errors
- The onnxruntime python package is not installed. Please inst
- The tokenizers python package is not installed. Please insta
- The tqdm python package is not installed. Please install it
- The open_clip python package is not installed. Please instal
- The torch python package is not installed. Please install it
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/951fad2b66ece967.
Report an issue: GitHub.