mem0ai/mem0 · error · ImportError
FastEmbed is not installed. Please install it using `pip in
Error message
FastEmbed is not installed. Please install it using `pip install fastembed`
What it means
mem0/embeddings/fastembed.py imports fastembed.TextEmbedding inside try/except ImportError and re-raises with a pip hint. fastembed is an optional dependency (installable via the mem0ai[fastembed] extra or directly), so selecting provider='fastembed' without the package fails at import time — before any config validation runs.
Source
Thrown at mem0/embeddings/fastembed.py:9
from typing import Literal, Optional
from mem0.configs.embeddings.base import BaseEmbedderConfig
from mem0.embeddings.base import EmbeddingBase
try:
from fastembed import TextEmbedding
except ImportError:
raise ImportError("FastEmbed is not installed. Please install it using `pip install fastembed`")
class FastEmbedEmbedding(EmbeddingBase):
def __init__(self, config: Optional[BaseEmbedderConfig] = None):
super().__init__(config)
self.config.model = self.config.model or "thenlper/gte-large"
self.dense_model = TextEmbedding(model_name=self.config.model)
if not self.config.embedding_dims:
self.config.embedding_dims = self.dense_model.embedding_size
def embed(self, text, memory_action: Optional[Literal["add", "search", "update"]] = None):
"""
Convert the text to embeddings using FastEmbed running in the Onnx runtime
Args:
text (str): The text to embed.
memory_action (optional): The type of embedding to use. Must be one of "add", "search", or "update". Defaults to None.
Returns:View on GitHub (pinned to 001c235229)
Solutions
- pip install fastembed
- Install via the extra: pip install 'mem0ai[fastembed]' so the pairing stays consistent
- Verify in the runtime interpreter: <python> -c 'import fastembed'
Example fix
# before: ImportError at import time # after # shell: pip install fastembed
Defensive patterns
Strategy: validation
Validate before calling
try:
from fastembed import TextEmbedding # noqa: F401
except ImportError:
raise RuntimeError("fastembed embedder requires: pip install fastembed") Prevention
- Install via mem0ai[fastembed] extra to keep versions aligned
- Add a startup import probe for each configured optional dependency
When it happens
Trigger: embedder={'provider': 'fastembed', ...} with fastembed not installed; installing with pip but running under a different Python (e.g. system python vs venv); a fresh clone where only mem0ai core was installed.
Common situations: pip install mem0ai does not include fastembed; onnxruntime/platform wheels missing on ARM or slim images making fastembed uninstallable; uv/poetry lockfile without the extra.
Related errors
- The 'boto3' library is required. Please install it using 'pi
- langchain is not installed. Please install it using `pip ins
- The 'upstash_vector' library is required. Please install it
- Unsupported FastEmbed model "${config.model}". Supported mod
- FastEmbed embed() returned no embeddings
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/2511dc564404d949.
Report an issue: GitHub.