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

Error: WidgetManager already initialized #12892

Closed
rzhao271 opened this issue Feb 21, 2023 · 5 comments
Closed

Error: WidgetManager already initialized #12892

rzhao271 opened this issue Feb 21, 2023 · 5 comments
Assignees

Comments

@rzhao271
Copy link
Contributor

Testing #12874

Jupyter extension version: v2023.2.1000531229
Python extension version: v2023.3.10481011
Using ipywidgets 7

  1. Create a new notebook.
  2. Add the following cell
# Sample1
from ipyleaflet import Map, Marker

center = (52.204793, 360.121558)

m = Map(center=center, zoom=15)

marker = Marker(location=center, draggable=True)
m.add_layer(marker);

display(m)
  1. Run the notebook.
  2. Add the following cell
# Sample2
import k3d
import numpy as np
from numpy import sin,cos,pi
from ipywidgets import interact, interactive, fixed
import ipywidgets as widgets
import time
import math

plot = k3d.plot()

plot.camera_auto_fit = False

T = 1.618033988749895
r = 4.77
zmin,zmax = -r,r
xmin,xmax = -r,r
ymin,ymax = -r,r
Nx,Ny,Nz = 77,77,77

x = np.linspace(xmin,xmax,Nx)
y = np.linspace(ymin,ymax,Ny)
z = np.linspace(zmin,zmax,Nz)
x,y,z = np.meshgrid(x,y,z,indexing='ij')
p = 2 - (cos(x + T*y) + cos(x - T*y) + cos(y + T*z) + cos(y - T*z) + cos(z - T*x) + cos(z + T*x))
iso = k3d.marching_cubes(p.astype(np.float32),xmin=xmin,xmax=xmax,ymin=ymin,ymax=ymax, zmin=zmin, zmax=zmax, level=0.0)
plot += iso

plot.display()
  1. Run the entire notebook again.
  2. Run the first cell again.
  3. 🐛 No rendered outputs.

Devtools errors:
I see a few WebSocket is already in CLOSING or CLOSED state. errors, but the more immediate errors are the Error: WidgetManager already initialized errors, which I see whenever I run the notebook again.

@rzhao271
Copy link
Contributor Author

It's harder for me to repro the issue with ipywidgets 8, but I hit the issue again.
The failure to render upon a re-run seems to occur when the WebSocket is already in CLOSING or CLOSED state. error occurs.

@DonJayamanne
Copy link
Contributor

The failure to render upon a re-run seems to occur when the WebSocket is already in CLOSING or CLOSED state. error occurs.

this is a know issue with the Jupyter server itself, they have an upstream issue for this.
will see if tehre'a work around for this.

WidgetManager already initialized

I should change this message to a warning or information (its actually not an error)
Having this as an error confuses users (like your self and could lead users down the wrong path)

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Feb 21, 2023

@rzhao271
Could you try the following to get around the issue with socket failures,
Ensure you run this against the right python environment against which you have jupyter installed
python -m pip install jupyter-client==7.3.2 tornado==6.1

Then test again, that should get things working.

@rzhao271
Copy link
Contributor Author

Seems like the notebooks render fine after that change using ipywidget 8.

@DonJayamanne
Copy link
Contributor

If that works, then lets close this issue as resolved.
If there are other issues or this is still unresolved please feel free to re-open this issue

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants