Dask Gateway

raw JSON →
2026.3.0 verified Fri May 01 auth: no python

A client library for interacting with a Dask Gateway server, enabling scalable multi-tenant HPC and cloud deployments. Version 2026.3.0 supports Python ≥3.10. Released ~2x per year, stable API.

pip install dask-gateway
error ModuleNotFoundError: No module named 'dask_gateway'
cause dask-gateway not installed in the current Python environment.
fix
Run pip install dask-gateway.
error dask_gateway.exceptions.GatewayError: 401 Unauthorized - authentication failed
cause Invalid or missing authentication credentials.
fix
Pass the correct auth parameter (e.g., auth='jupyterhub') or set DASK_GATEWAY_AUTH environment variable.
error TypeError: __init__() got an unexpected keyword argument 'proxy_address'
cause In older versions (pre-2023.1.0), the `proxy_address` parameter was not available.
fix
Upgrade dask-gateway: pip install --upgrade dask-gateway.
breaking In v2024.1.0, the default auth no longer falls back to 'jupyterhub'. You must explicitly pass `auth='jupyterhub'` or set environment variables.
fix Pass `auth='jupyterhub'` when using JupyterHub, or configure `DASK_GATEWAY_AUTH` env var.
deprecated The `GatewayCluster.adapt()` method is deprecated. Use `auto_scale()` instead.
fix Replace `cluster.adapt(...)` with `cluster.auto_scale(...)`.
gotcha When using Kerberos auth, the server must have the same Kerberos principal configured. Otherwise, authentication fails with a vague HTTP 401.
fix Ensure Dask Gateway server has `kerberos.principal` set correctly in its config.
pip install dask-gateway[kerberos]
pip install dask-gateway[jupyter]

Creates a Dask Gateway cluster, scales to 2 workers, and gets a client.

import os
from dask_gateway import GatewayCluster

# Create a cluster with token auth (or env vars)
cluster = GatewayCluster(
    address=os.environ.get('DASK_GATEWAY_ADDRESS', 'http://gateway:8080'),
    proxy_address=os.environ.get('DASK_GATEWAY_PROXY_ADDRESS', 'gateway:8786'),
    auth='jupyterhub' if os.environ.get('JUPYTERHUB_USER') else None
)
cluster.scale(2)
client = cluster.get_client()
# Submit work
client.close()
cluster.close()