{"record":{"id":"4b57af77e7931ce3","repo":"mlflow/mlflow","slug":"the-databricks-agents-package-is-required-to-use","errorCode":null,"errorMessage":"The `databricks-agents` package is required to use `mlflow.genai.datasets`. Please install it with `pip install databricks-agents`.","messagePattern":"The `databricks-agents` package is required to use `mlflow\\.genai\\.datasets`\\. Please install it with `pip install databricks-agents`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"mlflow/genai/datasets/__init__.py","lineNumber":242,"sourceCode":"    \"\"\"\n    if name is None:\n        raise ValueError(\"Parameter 'name' is required.\")\n\n    experiment_ids = [experiment_id] if isinstance(experiment_id, str) else experiment_id\n\n    if is_databricks_uri(get_tracking_uri()):\n        if tags is not None:\n            raise NotImplementedError(\n                \"Tags are not supported in Databricks environments. \"\n                \"Tags are managed through Unity Catalog.\"\n            )\n        try:\n            from databricks.agents.datasets import create_dataset as db_create\n\n            with _databricks_profile_env():\n                return EvaluationDataset(db_create(name, experiment_ids))\n        except ImportError as e:\n            raise ImportError(_ERROR_MSG) from e\n    else:\n        from mlflow.tracking.client import MlflowClient\n\n        if experiment_ids is None:\n            from mlflow.tracking.fluent import _get_experiment_id\n\n            current_exp_id = _get_experiment_id()\n            if current_exp_id:\n                experiment_ids = [current_exp_id]\n\n        mlflow_dataset = MlflowClient().create_dataset(\n            name=name,\n            experiment_id=experiment_ids,\n            tags=tags,\n        )\n        return EvaluationDataset(mlflow_dataset)\n\n","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/genai/datasets/__init__.py#L224-L260","documentation":"create_dataset delegates to the databricks.agents.datasets package on Databricks. If that optional dependency is not installed, the ImportError is re-raised as an ImportError telling you to install databricks-agents. The genai.datasets module is unusable on Databricks without it.","triggerScenarios":"Calling mlflow.genai.datasets.create_dataset() with a databricks:// tracking URI in an environment where `pip install databricks-agents` was never run.","commonSituations":"Fresh CI runners or local environments; deploying code to a container image that only includes mlflow core; sklearn-style skinny installs without extras.","solutions":["Run `pip install databricks-agents` in the active environment","Pin databricks-agents in requirements and rebuild the deployment image","Verify import works: `from databricks.agents.datasets import create_dataset`"],"exampleFix":"// before\nmlflow.genai.datasets.create_dataset(name=\"eval\")  # ImportError\n// after\n# shell: pip install databricks-agents\nmlflow.genai.datasets.create_dataset(name=\"eval\")","handlingStrategy":"validation","validationCode":"try:\n    import databricks.agents  # noqa\nexcept ImportError:\n    raise RuntimeError(\"pip install databricks-agents required for mlflow.genai.datasets on Databricks\")","typeGuard":null,"tryCatchPattern":"try:\n    ds = mlflow.genai.datasets.create_dataset(name=\"eval\")\nexcept ImportError as e:\n    logger.error(\"install databricks-agents: %s\", e)\n    raise","preventionTips":["Include databricks-agents in requirements for Databricks-targeting code","Smoke-test imports in CI before running genai dataset jobs","Use uv/pip extras so the dependency travels with the package"],"tags":["databricks","genai","datasets","missing-dependency","importerror"],"backgroundTag":"missing-package-dependency","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}