{"record":{"id":"2511dc564404d949","repo":"mem0ai/mem0","slug":"fastembed-is-not-installed-please-install-it-usi","errorCode":null,"errorMessage":"FastEmbed is not installed.  Please install it using `pip install fastembed`","messagePattern":"FastEmbed is not installed\\.  Please install it using `pip install fastembed`","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"mem0/embeddings/fastembed.py","lineNumber":9,"sourceCode":"from typing import Literal, Optional\n\nfrom mem0.configs.embeddings.base import BaseEmbedderConfig\nfrom mem0.embeddings.base import EmbeddingBase\n\ntry:\n    from fastembed import TextEmbedding\nexcept ImportError:\n    raise ImportError(\"FastEmbed is not installed.  Please install it using `pip install fastembed`\")\n\nclass FastEmbedEmbedding(EmbeddingBase):\n    def __init__(self, config: Optional[BaseEmbedderConfig] = None):\n        super().__init__(config)\n\n        self.config.model = self.config.model or \"thenlper/gte-large\"\n        self.dense_model = TextEmbedding(model_name=self.config.model)\n\n        if not self.config.embedding_dims:\n            self.config.embedding_dims = self.dense_model.embedding_size\n\n    def embed(self, text, memory_action: Optional[Literal[\"add\", \"search\", \"update\"]] = None):\n        \"\"\"\n        Convert the text to embeddings using FastEmbed running in the Onnx runtime\n        Args:\n            text (str): The text to embed.\n            memory_action (optional): The type of embedding to use. Must be one of \"add\", \"search\", or \"update\". Defaults to None.\n        Returns:","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/embeddings/fastembed.py#L1-L27","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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'"],"exampleFix":"# before: ImportError at import time\n\n# after\n# shell:\npip install fastembed","handlingStrategy":"validation","validationCode":"try:\n    from fastembed import TextEmbedding  # noqa: F401\nexcept ImportError:\n    raise RuntimeError(\"fastembed embedder requires: pip install fastembed\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install via mem0ai[fastembed] extra to keep versions aligned","Add a startup import probe for each configured optional dependency"],"tags":["import-error","fastembed","embeddings","dependencies","optional-dependency"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}