Skip to content

ssh: register the Databricks %pip magic on serverless environment 5+ - #7263

Merged
rclarey merged 4 commits into
mainfrom
deco-28307-ssh-jupyter-pip-magics
Nov 6, 2026
Merged

rclarey merged 4 commits into
mainfrom
deco-28307-ssh-jupyter-pip-magics

Conversation

@anton-107

@anton-107 anton-107 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Changes

On runtimes whose PipMagicOverrides takes a logger (serverless environment 5+), jupyter-init.py now builds the magic the way dbruntime's own kernel does. The driver conf, logger and environment resource client come from the driver connection, and the Py4J entry point is passed only where it exists. The constructor gained keyword arguments across runtime releases, so only the ones the installed runtime accepts are passed. This applies to any runtime with the newer constructor, including dedicated clusters on recent Databricks Runtime versions. Older runtimes keep the existing path.

Why

On serverless environments 5 and 6, the IPython startup script failed to register the Databricks %pip magic:

  • v5 (client.5.12): PipMagicOverrides.__init__() missing 1 required positional argument: 'logger'
  • v6 (client.6.5): 'NoneType' object has no attribute 'getDriverConf', because Py4J is off and there is no entry point

Dedicated clusters on recent Databricks Runtime versions hit the same logger error (seen on DBR 19.14). Notebooks opened over the tunnel then fell back to IPython's stock %pip. This blocks moving the tunnel's default environment off 4.

Tests

Tested on prod AWS us-west-2 CPU serverless, with this jupyter-init.py as the session's IPython startup script, through a real Jupyter kernel:

v4 v5 v6
%pip registered by PipMagicOverrides (unchanged) PipMagicOverrides (was stock) PipMagicOverrides (was stock)
%pip install humanize n/a Databricks handler, package importable same
spark.range(3).count() n/a 3 3

On v4 a kernel started from the session can't be reached (loopback is blocked there), so v4 was checked with terminal IPython only.

Also tested on a dedicated single-user cluster on DBR 19.14 (staging AWS), through a real Jupyter kernel: before this change %pip fell back to stock (missing 1 required positional argument: 'logger'). With it, %pip is registered by PipMagicOverrides with an active PipMagicHandler, %pip install humanize goes through the Databricks handler, and spark.range(3).count() returns 3.

anton-107 and others added 2 commits October 30, 2026 15:28
The IPython startup script built PipMagicOverrides with its older
constructor. On serverless environment 5 the constructor requires a
logger, and on environment 6 there is no Py4J entry point, so the call
failed and notebooks fell back to IPython's stock %pip.

When the constructor takes a logger, build it from the driver connection
the same way dbruntime's own kernel does, passing only the keyword
arguments the installed runtime accepts. Older runtimes keep the
existing path.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 0a842a7

Run: 42029488124

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 271 15 4:28
✅​ aws-windows-latest-4core-16gb 273 13 2:38
✅​ azure linux-2core-8gb 270 15 4:58
✅​ azure-windows-latest-4core-16gb 272 13 3:04
✅​ gcp linux-2core-8gb 271 15 4:41
✅​ gcp-windows-latest-4core-16gb 273 13 2:55

Co-authored-by: Isaac <no-reply@databricks.com>
@rclarey
rclarey marked this pull request as ready for review November 5, 2026 12:24
@rclarey
rclarey requested review from a team as code owners November 5, 2026 12:24
… keyword

Only evaluate the optional constructor arguments the runtime accepts, so a
missing attribute behind a newer argument doesn't break %pip registration on
runtimes that don't take it.

Co-authored-by: Isaac <no-reply@databricks.com>
@rclarey
rclarey added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit 93ff843 Nov 6, 2026
30 checks passed
@rclarey
rclarey deleted the deco-28307-ssh-jupyter-pip-magics branch November 6, 2026 15:19
deco-sdk-tagging Bot added a commit that referenced this pull request Nov 9, 2026
## Release v1.25.0

### CLI

 * `databricks aitools install --output json` now reports a more specific `error_category` (`MANIFEST_NOT_FOUND`, `PERMISSION_DENIED`, `FILESYSTEM`) for some failures it reported as `UNCATEGORIZED`. ([#7380](#7380))
 * Suggest `databricks auth logout --profile <profile-name> --delete` when multiple profiles match the same workspace in `databricks auth docker` commands. ([#7363](#7363))
 * Fix `%pip` in Jupyter notebooks opened over `databricks ssh connect` on serverless environment versions 5 and 6 and on dedicated clusters running recent Databricks Runtime versions, which fell back to the stock IPython magic instead of the Databricks one. ([#7263](#7263))

### AI Runtime

 * `databricks air run` now validates the config server-side while it uploads the run artifacts, instead of before, which shortens submission. ([#7368](#7368))
 * Remove `CRITICAL` as a valid `compute.priority_class` value; the AI Runtime API no longer accepts it. ([#7371](#7371))

### Bundles

 * Built-in templates add the workspace ID to `workspace.host` (`?w=<id>`) when the profile or an environment variable sets it, so generated bundles select the right workspace on hosts shared by several workspaces. Welcome messages show the same URL, and `dbt-sql` also adds `?o=<id>` to the HTTP path it suggests for `dbt init`. ([#7350](#7350))
 * Fix grants of a renamed or recreated catalog, schema, volume or other UC resource staying recorded under the old name, which made the next `bundle plan` propose to apply them again. ([#7345](#7345))
 * Fix permissions of a recreated pipeline, app, dashboard, model serving endpoint or other resource staying recorded under the old ID, which made every later `bundle plan` propose to apply them again. ([#7361](#7361))
 * Add the `postgres_data_apis` resource (Private Preview) for enabling and configuring the Data API of a Lakebase Postgres database. ([#7160](#7160))
 * Fixes [#4012](#4012): registered model `aliases` are now set in Unity Catalog on deploy instead of being silently ignored. A model without an `aliases` section keeps the aliases set outside the bundle (for example by MLflow), and `aliases: []` removes them. ([#7163](#7163))
 * Include variable declarations and the source of each resolved value in the `--include-locations` output of `bundle validate` and `bundle summary`. ([#7351](#7351))
 * Add `.workspace.URLID` to bundle templates: the workspace ID that `.workspace.URL` adds, or empty, so templates can use it without failing when the ID is unknown. ([#7388](#7388))
 * Expose the workspace of the selected profile to bundle templates as `.workspace`, with `Hostname`, `ID`, and `URL`, so templates can address a workspace on a host shared by several workspaces. A template input named `workspace` takes precedence. ([#7349](#7349))

### Dependency Updates

 * Bump dependencies with known vulnerabilities. ([#7394](#7394))
 * Upgrade `github.com/mattn/go-runewidth` to v0.0.31, which removes ~30ms of startup time from every command. ([#7391](#7391))
 * Update the Go SDK to [v0.194.0](https://github.com/databricks/databricks-sdk-go/releases/tag/v0.194.0). ([#7371](#7371))
 * Update the Go SDK to [v0.195.0](https://github.com/databricks/databricks-sdk-go/releases/tag/v0.195.0). ([#7384](#7384))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants