{"record":{"id":"638a07148bcacda7","repo":"crewAIInc/crewAI","slug":"minds-sdk-package-not-found-please-run-pip-ins","errorCode":null,"errorMessage":"`minds_sdk` package not found, please run `pip install minds-sdk`","messagePattern":"`minds_sdk` package not found, please run `pip install minds-sdk`","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/ai_mind_tool/ai_mind_tool.py","lineNumber":59,"sourceCode":"            ),\n        ]\n    )\n\n    def __init__(self, api_key: str | None = None, **kwargs: Any) -> None:\n        super().__init__(**kwargs)\n        self.api_key = api_key or os.getenv(\"MINDS_API_KEY\")\n        if not self.api_key:\n            raise ValueError(\n                \"API key must be provided either through constructor or MINDS_API_KEY environment variable\"\n            )\n\n        try:\n            from minds.client import Client  # type: ignore[import-not-found]\n            from minds.datasources import (  # type: ignore[import-not-found]\n                DatabaseConfig,\n            )\n        except ImportError as e:\n            raise ImportError(\n                \"`minds_sdk` package not found, please run `pip install minds-sdk`\"\n            ) from e\n\n        minds_client = Client(api_key=self.api_key)\n\n        datasources = []\n        for datasource in self.datasources:\n            config = DatabaseConfig(\n                name=f\"{AIMindToolConstants.DATASOURCE_NAME_PREFIX}_{secrets.token_hex(5)}\",\n                engine=datasource[\"engine\"],\n                description=datasource[\"description\"],\n                connection_data=datasource[\"connection_data\"],\n                tables=datasource[\"tables\"],\n            )\n            datasources.append(config)\n\n        name = f\"{AIMindToolConstants.MIND_NAME_PREFIX}_{secrets.token_hex(5)}\"\n","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/ai_mind_tool/ai_mind_tool.py#L41-L77","documentation":"AIMindTool's constructor tries to import minds.client and minds.datasources after validating the API key; if the optional minds_sdk distribution is not installed, the ImportError is caught and re-raised with an install hint. This is the standard CrewAI pattern for optional tool dependencies — the package is not bundled with crewai-tools by default.","triggerScenarios":"Constructing AIMindTool in an environment where `pip install minds-sdk` was never run, or where it is installed in a different virtualenv/interpreter than the one running CrewAI.","commonSituations":"Fresh clone/new venv without extras; UV/poetry lockfiles missing the optional dep; CI cache restored without the package; multiple Python interpreters (system vs venv).","solutions":["Install the SDK: `pip install minds-sdk` (or `uv add minds-sdk`).","Confirm the install landed in the running interpreter: `python -c \"import minds.client\"` using the same python that runs the app.","Add minds-sdk to your project dependencies so fresh environments get it automatically."],"exampleFix":"# before\ntool = AIMindTool(datasources=[...])  # ImportError\n\n# after (shell)\n# pip install minds-sdk\ntool = AIMindTool(datasources=[...])","handlingStrategy":"fallback","validationCode":"def minds_sdk_available() -> bool:\n    try:\n        import minds.client  # noqa: F401\n        return True\n    except ImportError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    tool = AIMindTool(datasources=[...])\nexcept ImportError as e:\n    if \"minds_sdk\" in str(e):\n        raise SystemExit(\"Install missing dependency: pip install minds-sdk\") from e\n    raise","preventionTips":["Add optional tool SDKs to your lockfile when you adopt the tool — don't rely on runtime install hints.","Gate tool construction behind an availability probe when the feature is optional.","Verify imports with the same interpreter that runs the app, not a stray shell."],"tags":["dependencies","import-error","installation","optional-package"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}