{"record":{"id":"0c043328aa25e306","repo":"crewAIInc/crewAI","slug":"databricks-sdk-package-not-found-please-run-uv","errorCode":null,"errorMessage":"`databricks-sdk` package not found, please run `uv add databricks-sdk`","messagePattern":"`databricks-sdk` package not found, please run `uv add databricks-sdk`","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/crewai-tools/src/crewai_tools/tools/databricks_query_tool/databricks_query_tool.py","lineNumber":165,"sourceCode":"            \"DATABRICKS_HOST\" in os.environ and \"DATABRICKS_TOKEN\" in os.environ\n        )\n\n        if not (has_profile or has_direct_auth):\n            raise ValueError(\n                \"Databricks authentication credentials are required. \"\n                \"Set either DATABRICKS_CONFIG_PROFILE or both DATABRICKS_HOST and DATABRICKS_TOKEN environment variables.\"\n            )\n\n    @property\n    def workspace_client(self) -> WorkspaceClient:\n        \"\"\"Get or create a Databricks WorkspaceClient instance.\"\"\"\n        if self._workspace_client is None:\n            try:\n                from databricks.sdk import WorkspaceClient\n\n                self._workspace_client = WorkspaceClient()\n            except ImportError as e:\n                raise ImportError(\n                    \"`databricks-sdk` package not found, please run `uv add databricks-sdk`\"\n                ) from e\n        return self._workspace_client\n\n    def _format_results(self, results: list[dict[str, Any]]) -> str:\n        \"\"\"Format query results as a readable string.\"\"\"\n        if not results:\n            return \"Query returned no results.\"\n\n        if not results[0]:\n            return \"Query returned empty rows with no columns.\"\n\n        columns = list(results[0].keys())\n\n        if not columns:\n            return \"Query returned rows but with no column data.\"\n\n        # Calculate column widths based on data","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/crewai-tools/src/crewai_tools/tools/databricks_query_tool/databricks_query_tool.py#L147-L183","documentation":"DatabricksQueryTool lazily builds a databricks.sdk WorkspaceClient in its workspace_client property. The first access does 'from databricks.sdk import WorkspaceClient'; if the databricks-sdk distribution is not installed in the current interpreter, the ImportError is caught and re-raised as this message instructing 'uv add databricks-sdk'. Note the name mismatch: the PyPI package is databricks-sdk, the import root is databricks.sdk.","triggerScenarios":"Accessing tool.workspace_client (directly or by calling tool._run/query) in an environment without databricks-sdk installed; installing 'databricks' (a different legacy package) instead of 'databricks-sdk'; tool running under a different venv/interpreter than the one where you installed the SDK.","commonSituations":"Missing optional dependency when crewai-tools is installed without the databricks extra; CI image lacking the package; confusing 'databricks' vs 'databricks-sdk' on PyPI; pip install into the wrong environment.","solutions":["Install the SDK: uv add databricks-sdk (or pip install databricks-sdk).","Verify the import works in the same interpreter the tool runs under: python -c \"from databricks.sdk import WorkspaceClient\".","If you installed 'databricks' by mistake, uninstall it and install 'databricks-sdk'.","Add databricks-sdk to your Dockerfile / requirements / lockfile so it is always present."],"exampleFix":"# before\ntool = DatabricksQueryTool()\ntool.run(query=\"SELECT 1\")  # ImportError: `databricks-sdk` package not found\n\n# after\n# shell:\n#   uv add databricks-sdk\ntool.run(query=\"SELECT 1\")","handlingStrategy":"validation","validationCode":"def databricks_sdk_available() -> bool:\n    try:\n        from databricks.sdk import WorkspaceClient  # noqa: F401\n        return True\n    except ImportError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    client = tool.workspace_client\nexcept ImportError as e:\n    if \"databricks-sdk\" in str(e):\n        raise SystemExit(\"Install databricks-sdk (uv add databricks-sdk) and rerun\") from e\n    raise","preventionTips":["Add databricks-sdk to the lockfile/Dockerfile of every environment that uses the tool.","Watch for the 'databricks' vs 'databricks-sdk' PyPI name trap.","Startup smoke test: import databricks.sdk before the agent loop begins."],"tags":["databricks","import","dependency","optional-dependency","sdk"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}