Skip to content

fix: handle jupyter-kernel-client >= 1.0.0 KernelClient rename - #133

Closed
dpaul0501 wants to merge 1 commit into
googlecolab:mainfrom
dpaul0501:fix/jupyter-kernel-client-rename-KernelClient
Closed

dpaul0501 wants to merge 1 commit into
googlecolab:mainfrom
dpaul0501:fix/jupyter-kernel-client-rename-KernelClient

Conversation

@dpaul0501

Copy link
Copy Markdown

Problem

jupyter-kernel-client v1.0.0 renamed KernelClient → JupyterKernelClient. The else branch in runtime.py still references the old name, causing every colab run, colab exec, colab install, and colab sessions command to fail with:

AttributeError: module 'jupyter_kernel_client' has no attribute 'KernelClient'

This affects any user who has jupyter-kernel-client >= 1.0.0 installed (e.g. via Homebrew Python or a fresh pip install).

Fix

Use getattr with a fallback to JupyterKernelClient so both old (< 1.0.0) and new (>= 1.0.0) versions of the dependency work:

_KernelCls = getattr(
    jupyter_kernel_client, "KernelClient", None
) or jupyter_kernel_client.JupyterKernelClient
self._kernel_client = _KernelCls(...)

Tested

Verified on macOS with jupyter-kernel-client==1.0.2 — colab sessions and colab run no longer throw AttributeError.

🤖 Generated with Claude Code

@google-cla

google-cla Bot commented Sep 18, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

jupyter-kernel-client v1.0.0 renamed `KernelClient` to `JupyterKernelClient`.
The fallback `else` branch in runtime.py still calls the old name, causing:

    AttributeError: module 'jupyter_kernel_client' has no attribute 'KernelClient'

Fix: use getattr with fallback to JupyterKernelClient so both old (<1.0.0)
and new (>=1.0.0) versions of jupyter-kernel-client work correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dpaul0501
dpaul0501 force-pushed the fix/jupyter-kernel-client-rename-KernelClient branch from f2a1c7b to 740a492 Compare September 18, 2026 10:10
@sethtroisi

Copy link
Copy Markdown
Collaborator

#125 merged and fixes the issue.

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.

2 participants