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

Widgets not rendering after reloading vscode #5424

Closed
Syndorik opened this issue Apr 6, 2021 · 7 comments
Closed

Widgets not rendering after reloading vscode #5424

Syndorik opened this issue Apr 6, 2021 · 7 comments
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@Syndorik
Copy link

Syndorik commented Apr 6, 2021

Environment data

  • VS Code Insiders: 1.56.0-insider 550035808407c15252e581e8abe1b820b9d311ee x64
  • Jupyter Extension version (available under the Extensions sidebar): 2021.6.718745073
  • Python Extension version (available under the Extensions sidebar): 2021.3.680753044
  • OS (Windows | Mac | Linux distro) and version: Windows10
  • Python and/or Anaconda version: 3.9.2
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Jupyter server running: Remote
  • IpyWidgets==7.6.3

Behavior

When I'm initializing the jupyter server, connecting the notebook for the first time and runing the following cell

from tqdm.notebook import tqdm
[k for k in tqdm(range(10))]

image

The ipywidget is displaying correctly. However, if I exit the notebook and comeback or if I reload the notebook, the Ipywidget does not render anymore.
image

When I toggle the developper tools, on reload I have the following warning
image

@Syndorik Syndorik added the bug Issue identified by VS Code Team member as probable bug label Apr 6, 2021
@rchiodo
Copy link
Contributor

rchiodo commented Apr 7, 2021

This is a side effect of us closing kernels when closing notebooks. Jupyter has the same problem but at least tells you why:

image

@Syndorik
Copy link
Author

Syndorik commented Apr 7, 2021

Ok thanks for the information,
But, when I rerun the cell with a new runing kernel, the widget is still not rendering. In jupyter I think the ipywidgets is rerendering if you rerun the cell with a new kernel after shuting down the other.
In vscode if I close a notebook/reload it and then rerun the cell it doesn't work.

@rchiodo
Copy link
Contributor

rchiodo commented Apr 7, 2021

I'm reproing that too. Very weird. Although closing and reopening the notebook makes it work for me.

My guess is that reloading a kernel does not remove the preload scripts that the first kernel added. This interferes with ipywidgets working.

@Syndorik
Copy link
Author

Syndorik commented Apr 7, 2021

I tested, and I need to kill all runing kernel (via the rest API) and then reload the window. If I do that, the IpyWidgets works again. Just closing the notebook an reopening it doesn't work for me

@rchiodo rchiodo added this to the May 2021 Release milestone Apr 8, 2021
@rchiodo
Copy link
Contributor

rchiodo commented Apr 8, 2021

If VS code provides a way to detect this we should use it, or we need to set some global state to detect this ourselves.

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Apr 12, 2021

In general IPyWidgets will not be re-loaded whether we re-load or close/re-open a notebook, unless we have #4404 (which is what Rich has highlighted #5424 (comment))

@greazer greazer modified the milestones: May 2021 Release, June 2021 Release Apr 26, 2021
@joyceerhl
Copy link
Contributor

Validated (I think). In Insiders now if I execute a notebook with ipyvolume widgets, then reload, the widget doesn't initially show, but I can reexecute the cell and see the widget appear in the cell output.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2021
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
Projects
None yet
Development

No branches or pull requests

5 participants