{"record":{"id":"860fe2f35637d5a7","repo":"mem0ai/mem0","slug":"the-upstash-vector-library-is-required-please-i","errorCode":null,"errorMessage":"The 'upstash_vector' library is required. Please install it using 'pip install upstash_vector'.","messagePattern":"The 'upstash_vector' library is required\\. Please install it using 'pip install upstash_vector'\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"mem0/configs/vector_stores/upstash_vector.py","lineNumber":9,"sourceCode":"import os\nfrom typing import Any, ClassVar, Dict, Optional\n\nfrom pydantic import BaseModel, ConfigDict, Field, model_validator\n\ntry:\n    from upstash_vector import Index\nexcept ImportError:\n    raise ImportError(\"The 'upstash_vector' library is required. Please install it using 'pip install upstash_vector'.\")\n\n\nclass UpstashVectorConfig(BaseModel):\n    Index: ClassVar[type] = Index\n\n    url: Optional[str] = Field(None, description=\"URL for Upstash Vector index\")\n    token: Optional[str] = Field(None, description=\"Token for Upstash Vector index\")\n    client: Optional[Index] = Field(None, description=\"Existing `upstash_vector.Index` client instance\")\n    collection_name: str = Field(\"mem0\", description=\"Namespace to use for the index\")\n    enable_embeddings: bool = Field(\n        False, description=\"Whether to use built-in upstash embeddings or not. Default is True.\"\n    )\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def check_credentials_or_client(cls, values: Dict[str, Any]) -> Dict[str, Any]:\n        client = values.get(\"client\")\n        url = values.get(\"url\") or os.environ.get(\"UPSTASH_VECTOR_REST_URL\")","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/configs/vector_stores/upstash_vector.py#L1-L27","documentation":"mem0/embeddings and vector-store configs import optional dependencies inside try/except ImportError blocks. If the upstash-vector package is not installed, importing UpstashVectorConfig's module re-raises ImportError with install instructions. Note the package is installed as 'upstash-vector' (pip) but imported as 'upstash_vector' (module), and the message reflects the module name.","triggerScenarios":"Selecting vector_store={'provider': 'upstash_vector', ...} without having installed the extra; installing into a different virtualenv/Python than the one running the app; a requirements file that lists upstash but not upstash-vector.","commonSituations":"pip install mem0ai pulls only core deps; provider extras must be installed manually; using poetry/pdm/uv where the dependency was added to a different group; Docker image built without the extra.","solutions":["pip install upstash-vector (the PyPI name uses a hyphen)","Confirm it landed in the interpreter running the app: <python-used> -m pip install upstash-vector","Add upstash-vector to requirements.txt/pyproject dependencies for reproducible environments"],"exampleFix":"# before: ImportError at import time\n\n# after\n# shell:\npip install upstash-vector","handlingStrategy":"validation","validationCode":"try:\n    import upstash_vector  # noqa: F401\n    HAS_UPSTASH = True\nexcept ImportError:\n    HAS_UPSTASH = False\n\nif provider == \"upstash_vector\" and not HAS_UPSTASH:\n    raise RuntimeError(\"run: pip install upstash-vector\")","typeGuard":null,"tryCatchPattern":"try:\n    from mem0.vector_stores.upstash_vector import UpstashVector\nexcept ImportError as e:\n    if \"upstash_vector\" in str(e):\n        subprocess check or fail fast with install instructions\n    raise","preventionTips":["Declare optional provider deps as explicit extras (mem0ai[...] or a provider extras group) in your manifest","Smoke-test imports of every configured provider at application startup"],"tags":["import-error","upstash","vector-store","dependencies","optional-dependency"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}