Install & Compatibility
Where this runs
tested against v0.18.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 25.7MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 3.7s · import 0.000s · 26MB
24MB installed
● package 24MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
initialize_cli_for_databricks_notebooks
✓ from databricks_cli import initialize_cli_for_databricks_notebooks
✗ from databricks.sdk import WorkspaceClient
This quickstart first demonstrates how to use the recommended `databricks-sdk` for Python to programmatically list Databricks clusters, assuming authentication via environment variables (`DATABRICKS_HOST`, `DATABRICKS_TOKEN`). It also highlights typical command-line usage for both the legacy `databricks-cli` and the recommended new `databricks` CLI executable. Users should migrate programmatic logic to `databricks-sdk` and command-line scripts to the new `databricks` CLI.
# Authenticate via environment variables (recommended for quickstart)
# export DATABRICKS_HOST="https://<your-workspace-url>"
# export DATABRICKS_TOKEN="dapiXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
# --- Old databricks-cli usage (deprecated) ---
# The primary use was via the command line, e.g.:
# databricks clusters list
# --- New Databricks SDK for Python (recommended for programmatic access) ---
import os
from databricks.sdk import WorkspaceClient
# The SDK automatically uses DATABRICKS_HOST and DATABRICKS_TOKEN environment variables
w = WorkspaceClient(
host=os.environ.get('DATABRICKS_HOST', ''),
token=os.environ.get('DATABRICKS_TOKEN', '')
)
# Example: List clusters using the new SDK
print("Listing Databricks clusters (using new SDK):")
for c in w.clusters.list():
print(f" - {c.cluster_name} ({c.cluster_id})")
# --- New Databricks CLI executable (recommended for command-line access) ---
# After installing the new CLI executable (not this Python package):
# databricks auth login --host https://<your-workspace-url>
# databricks clusters list
databricks --version
Debug
Known issues
breakingThis `databricks-cli` Python package is deprecated. It receives no new features or support. For programmatic use, migrate to `databricks-sdk-py`. For command-line use, migrate to the new standalone `databricks/cli` executable. Failure to migrate will result in outdated functionality and potential compatibility issues.fixFor Python SDK usage: `pip install databricks-sdk` and update imports/code to use `databricks.sdk.WorkspaceClient` or `databricks.sdk.AccountClient`. For CLI usage: Install the new Databricks CLI executable via `curl -fsSL https://raw.githubusercontent.com/databricks/setup-cli/main/install.sh | sh` and adapt scripts to use the new `databricks` commands.
affects: 0.18.0 and below
deprecatedPersonal Access Token (PAT) authentication for Databricks is deprecated, and basic authentication (username/password) reached End-of-Life on July 10, 2024. New projects should use OAuth machine-to-machine (M2M) or user-to-machine (U2M) authentication.fixTransition authentication methods to Databricks unified authentication, prioritizing OAuth M2M/U2M. Update `DATABRICKS_TOKEN` usage to alternative methods where possible. Refer to Databricks authentication documentation for the latest best practices.
affects: All versions
gotchaVersion 0.18.0 of `databricks-cli` removed the explicit pin on `urllib3 < 2`. While this unblocks newer `urllib3` versions, older environments might encounter compatibility issues if they upgrade `databricks-cli` but retain an old `urllib3` that has breaking changes with other dependencies.fixEnsure `urllib3` is updated to a compatible version alongside `databricks-cli` (or its recommended replacements, the `databricks-sdk` or new CLI) to avoid unexpected errors. If encountering issues, check the `urllib3` version in your environment and upgrade it or pin a known working version.
affects: 0.18.0
Upgrade
Version history
0.18.0latest on PyPI · released Oct 5, 2023
Audit
Dependencies
pythonrequiredRequired for running the Python package.