Closed ljchang closed 3 months ago
hey @ljchang, thanks for the report, and apologies for the delay. Turns out there were actually 2 separate bugs here:
TypeError
in your screenshot was thrown by one of the callback functions Hypertools registers with IPython's EventManger
for managing the Matplotlib backend around interactive/animated plots. Basically, we defer resetting the plotting backend until just before the next cell you run is executed so that animations don't stop when switching back to inline static plotting. IPython used to be pretty lenient about these callbacks' signatures but it looks like that changed in v8.17 (ipython/ipython#14216).IPython
and Jupyter
JS objects that Matplotlib's default backend for interactive inline plots in "classic" notebooks (nbAgg
) relied on. Looks like most everything (now including Hypertools) has transitioned to using ipympl
for inline animations, but the various GUI-based interactive backends should still work too (Qt[4|5]Agg
, GTK[3|4]Agg
, TkAgg
, WebAgg
, WXAgg
, MacOSX
, etc.)I've implemented fixes for both issues in paxtonfitzpatrick/hypertools@fa28a7901277c01ebc0c49f1a3ceaff11cbcf952. Once I merge those in (hopefully tonight), I'll take a look at #262 (thanks for that PR as well!).
@ljchang this should now be fixed on master if you'd like to try it out!
pip install git+https://github.com/ContextLab/hypertools.git
Animated & interactive plots should now automatically work in both "classic" notebooks and Notebook v7+, as well as in JupyterLab.
One quick thing to note is that if you run your Jupyter notebook/lab server from a different environment than your IPython kernel, you'll also need to pip install ipympl
into the notebook server's environment, then shutdown and re-launch the server. This will provide the JS components that the notebook/lab frontend needs to display interactive plots.
I'm gonna close this for now, but if you run into any more issues please feel free to re-open! Thanks again!
There was a major update to Jupyter Notebook/Lab from Version 6 to Version 7 this past year.
The hypertools helper functions that deal with backends when plotting animations do not seem to be compatible with the new version of jupyter notebook.
Everything works when I switch to using the old version (i.e., nbclassic).
Just wanted to bring this to your attention. Thanks!