Repository navigation
ssh: register the Databricks %pip magic on serverless environment 5+ - #7263
Merged
Merged
Conversation
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>
Collaborator
✅ Integration test reportCommit: 0a842a7
|
Co-authored-by: Isaac <no-reply@databricks.com>
… 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
approved these changes
Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
On runtimes whose
PipMagicOverridestakes alogger(serverless environment 5+),jupyter-init.pynow 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
%pipmagic:client.5.12):PipMagicOverrides.__init__() missing 1 required positional argument: 'logger'client.6.5):'NoneType' object has no attribute 'getDriverConf', because Py4J is off and there is no entry pointDedicated clusters on recent Databricks Runtime versions hit the same
loggererror (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.pyas the session's IPython startup script, through a real Jupyter kernel:%pipregistered byPipMagicOverrides(unchanged)PipMagicOverrides(was stock)PipMagicOverrides(was stock)%pip install humanizespark.range(3).count()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
%pipfell back to stock (missing 1 required positional argument: 'logger'). With it,%pipis registered byPipMagicOverrideswith an activePipMagicHandler,%pip install humanizegoes through the Databricks handler, andspark.range(3).count()returns 3.