Interact widgets in Jupyter Notebook not reacting

I’ve been having a weird issue for a long time now. I’ve tried multiple things, but they only worked temporarily at best.

I’m using the package Interact in Jupyter Notebook to create some interactive plots. But the problem occurs generally with all Interact widgets:

The widget UI is rendered correctly, and the initial output is computed as well. However, the output is not updated when I click on any of the widgets. The widget UI reacts to my click, making me think I can interact with it, but the output just stays still. The kernel does not do anything at all, as far as I can tell from Jupyter’s little indicator in the top right corner.

More info on my setup: I’m running Julia version 1.4.1 on Windows 10 (64 bit). Jupyter Notebook is running in the latest version of Firefox, with JavaScript enabled. The problem occurs on both my desktop PC and my Laptop, both running the same OS and Julia version.

I have tried the following things. Some of them did nothing, sometimes the problem seemed to be fixed but then reappeared minutes or days later.

  • disabled adblockers and tracking blockers in Firefox (temporary success)
  • updated Firefox to the latest version (temporary success)
  • used Microsoft Edge (without any add-ons) instead of Firefox (no success)
  • switched to the latest Julia version 1.5.3 (no success)
  • used Pkg.build (temporary success)
  • installed Jupyter Notebook via Anaconda instead of via IJulia (temporary success)

Actually, before I started typing this, I opened the notebook and checked if the widgets react: they didn’t. But when I check right now, the widgets seem to have caught up somehow and updated the output multiple times. I’ve never seen this delayed behavior during the past few months that I had the issue, so I’m not sure whether this is always what happens.

Any tips would be greatly appreciated.

How long is the output computation time? In an old version of some interactive plotting I had similar problem already when the computation took just like 0.5 seconds. For the first interaction there could also be compilation time. So does it get smoother with a trivial plot?

No, if the issue occurs, it occurs even for the most simple widgets like
@manipulate for i in ["1","2"]; println(i); end
There is no reaction at all, apart from the widget UI.

I have actually noticed a similar issue to the one you mentioned. If the computation time is too long (for example in complicated plots), the widget output will not be rendered correctly. Instead, there will be some cryptic output, very similar to the one described here:

But in that case, I can see the kernel being busy, in contrary to my original issue.

The trick I have learnt (thanks to @shashi) is:

  1. Remove all output (with the option in one of the menus)
  2. Save the notebook
  3. Restart

Hopefully Interact.jl should now work.

Alternatively, switch to Pluto notebooks (Pluto.jl), where the reactivity works more smoothly.

3 Likes

I second the recommendation of Pluto.jl.
Works very smoothly for interactive Notebooks.

Did you try refreshing the page?
I also encountered something similar when switching from gr backend to plotly backend for plots.

Wow, this worked right away, thanks so much! I’m still a bit sceptical though since I haven’t tested this enough to know if it really works consistently. I’ll report back if it shouldn’t :slight_smile:

1 Like

Great! The problem is that you often have to do it when you come back to a notebook that’s stored on disk, which feels wrong.

1 Like

I had the same issue, and that fixed it for me as well!

1 Like