Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPyWidgets do not work when connecting to existing remote Jupyter Kernels #8179

Closed
DonJayamanne opened this issue Nov 5, 2021 · 5 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug ipywidgets Rendering, loading, saving, anything to do with IPyWidgets verified Verification succeeded
Milestone

Comments

@DonJayamanne
Copy link
Contributor

Reported by https://github.com/zpincus
#8085 (comment)

Unfortunately, even with the new changes in Jupyter extension version 2021.10.100, this bug in fact does still affect reconnecting to existing sessions on a remote server.

That is, connecting to a new kernel (and creating a session on the remote server) now no longer breaks ipywidgets, but when re-connecting to an existing session, widgets are still broken.

The easiest steps to reproduce this are:

  1. Switch to remote jupyter.
  2. Make two cells like so:
import ipywidgets
ipywidgets.IntSlider()
  1. Run all cells; note that the slider appears.
  2. Close notebook and reopen, or just reload the UI via the "reload" command.
  3. Due to Opening a notebook on remote, closing it, and reopening it does not reuse the same kernel #7610 you are actually now in a new session (you can verify by trying to run cell 2 and getting an NameError).
  4. Click on the "select kernel" button in the vscode UI, and select the existing session (which is the one created in step 3).
  5. Run just the second cell again. No NameError, but no slider either.

If you then go to the kernel picker and create a kernel session, you can run both cells and the slider reappears. But again connecting back to the existing session, the slider will not appear and ipywidgets remains broken.

@IanMatthewHuff would you prefer I create a new issue for this part of the bug, or just keep it all in this issue?

@DonJayamanne DonJayamanne added the bug Issue identified by VS Code Team member as probable bug label Nov 5, 2021
@DonJayamanne DonJayamanne self-assigned this Nov 5, 2021
@DonJayamanne DonJayamanne added ipywidgets Rendering, loading, saving, anything to do with IPyWidgets regression labels Nov 5, 2021
@zpincus
Copy link

zpincus commented Nov 5, 2021

Also per #8085, I can confirm that on v2021.10.1001414422 of the Jupyter extension ipywidgets continue to work when changing kernels on a local server (which starts a new kernel every time). Moreover, things also work on remote servers when starting up new kernels. The only breakage I note now is when connecting to an existing kernel on remote servers.

@DonJayamanne
Copy link
Contributor Author

@zpincus I've tested ipywidgets when connecting to remote kernels in the past 2 releases & I coulnd't get it to work.
I.e. its never worked, looking at the code, we've never supported this functionality.

However I've managed to fix this fairly easily (PR submitted).

@zpincus
Copy link

zpincus commented Nov 5, 2021

Thanks a ton! This is a big improvement.

FWIW, as far as I recall ipywidgets have worked on remote, but only in the context of a new session that vscode just started up on the remote server. I agree that widgets have definitely never worked in my recollection after reconnecting to an existing session; thanks for adding that.

@DonJayamanne
Copy link
Contributor Author

Fixed and it will be in the next insiders, we'll (team) discuss next week during our triage meeting whether to ship this as part of the recovery release or not (since its not a regression, its unlikely to ship as part of the recovery release).

Closing as this issue has been resolved,

@DonJayamanne
Copy link
Contributor Author

Testing steps:

  • Start jupyter server outside VS Code
  • Create a jupyter notebook and run a python cell such as print(1234)
  • Copy the URL
  • Start VS Code and connect to the above jupyter URl (as though we were connecting to a remote server)
  • Create a new notebook document in VS Code
  • Select the existing kernel (pointing to the document created in Jupyter)
  • Add the following cell & confirm widgets work
import ipywidgets
ipywidgets.IntSlider()

@rchiodo rchiodo added the verified Verification succeeded label Dec 1, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug ipywidgets Rendering, loading, saving, anything to do with IPyWidgets verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants