Hello. I have been using JupyterLite for a few months I have noticed this bug:
I don’t know if it possible to see in the gif, but I noticed that after a few interactions, the plot stops changing. I noticed that the Kernel isn’t triggered after a few interactions. This is something that I have noticed happening in JupyterLite for the past weeks with other interactive implementations. It was working fine until these past weeks. What could have caused this change? Why was it working before and isn’t now? Is there anyway to fix this? Could this be related to the memory of the browser? I have tried different browsers and different cmputers and incognito mode, and the result is the same, so I don’t believe that is it. Or is it incompatibility between packages (ipywidgets and matplotlib) with the current version of the kernel? What could be the cause and the possible solutions for this problem?
I have been facing great trouble trying to find a solution, any suggestions are very welcome.
Thank you.
Can anyone help me please?
@MartinaMJ does this also happen in regular JupyterLab?
Wondering if it’s an issue with JupyterLite, or just with ipywidgets
.
Hello @jtp . Thank you for your answer. Yes, it works normally in JupyterLab and JupyterNotebook locally. I am not familiar with how JupyterLite works, but I do think that perhaps ipywidgets has something to do with this error, since I tested one application that used Bokeh and it worked fine. Is there an alternative to using ipywidgets or anyway to fix this?
Thanks, it could indeed be an issue with ipywidgets, or with the handling of widgets in JupyterLite.
Would you be able to share a minimal code snippet to reproduce the issue?
For reference there seems to be an issue open about this, thanks for opening it! Pyodide becomes irresponsive after a few ipywidgets interactions · Issue #1465 · jupyterlite/jupyterlite · GitHub
Yes yes, I opened the issue. I will post the code snippet here and there as well.
The code for the example above is:
escalar01 = widgets.FloatText(value = 1, description = 'Black of first plot:', disabled = False, style= {'description_width': 'initial'})
escalar02 = widgets.FloatText(value = 1, description = 'Red of first plot:', disabled = False, style= {'description_width': 'initial'})
escalar03 = widgets.FloatText(value = 1, description = 'Black of second plot:', disabled = False,style= {'description_width': 'initial'})
escalar04 = widgets.FloatText(value = 1, description = 'Red of second plot:', disabled = False, style= {'description_width': 'initial'})
formatted1 = widgets.VBox([escalar01, escalar02])
formatted2 = widgets.VBox([escalar03, escalar04])
formatted3 = widgets.HBox([formatted1, formatted2])
def setas1(escalar01, escalar02, escalar03, escalar04):
fig, (ax1, ax2) = plt.subplots(1, 2)
plt.figure(figsize=(2, 2))
ax1.arrow(0, 0, escalar01, 0, width = 0.01, color = 'red', length_includes_head = True, head_width = 0.03)
ax1.arrow(0, 0, 0, escalar02, width = 0.01, color = 'black', length_includes_head = True, head_width = 0.03)
ax1.arrow(0, 0, escalar01, escalar02, width = 0.01, length_includes_head = True, head_width = 0.03)
ax1.grid()
ax2.arrow(0, 0, 4*escalar03, 3*escalar03, width = escalar03*(0.03), color = 'red', length_includes_head = True, head_width = escalar03*(0.08))
ax2.arrow(0, 0, 0, 2*escalar04, width = escalar03*(0.03), color = 'black', length_includes_head = True, head_width = escalar03*(0.08))
ax2.arrow(0, 0, 4*escalar03, 3*escalar03 + 2*escalar04, width = escalar03*(0.03), length_includes_head = True, head_width = escalar03*(0.08))
ax2.grid()
plt.show()
return 0
verif = interactive_output(setas1, {'escalar01': escalar01, 'escalar02': escalar02,
'escalar03': escalar03, 'escalar04': escalar04})
display(verif, formatted3)
I am importing: %pip install -q ipywidgets==8.0.7