Hello! I’ve been working on a project using nbinteract which uses the Binder service to show an interactive Jupyter notebook. I’m like 99% there but am running into one problem that I haven’t figured out how to overcome.
Issue: Trying to show a Matplotlib animation using funcanimation, and the animation shows fine in Jupyter Notebook with all attempted methods described below. However, it does NOT work in JupyterLab in any of the methods. I believe the nbinteract service uses Jupyterlab so there isn’t a way to not use it. Most of the issues revolve around getting the message “JavaScript output is disabled in JupyterLab” when running Matplotlib functionality. Want to see if my Binder installation files need any changes or any other ways to make this work.
- Running with %matplotlib notebook backend
When I use this, any Matplotlib functionality (even those not using animation) doesn’t work in JupyterLab and shows “JavaScript output is disabled in JupyterLab”. Is it possible to run %matplotlib notebook in JupyterLab successfully by adding some installation setting to the Binder server?
- Running with %matplotlib widget backend
When I use this, I don’t get the JavaScript error message but instead get no output when trying to show the graph and the following text displays: Canvas(toolbar=Toolbar(toolitems=[(‘Home’, ‘Reset original view’, ‘home’, ‘home’), (‘Back’, 'Back to previous …
There are a couple related threads out there (https://github.com/matplotlib/ipympl/issues/148 ) but I should have the required stuff installed. It mentions restarting Jupyter server, is there a way to do this from the terminal in Binder (if that is indeed needed)?
When I run with %matplotlib inline backend, I get no errors in Jupyterlab, but the animation only shows the first frame because inline won’t show animations, only the first static frame, which is why I likely need %matplotlib notebook or %matplotlib widget backend.
Here are my file contents that Binder uses for installation:
requirements.txt file:
numpy
ipywidgets
nbinteract
matplotlib
pandas
xlrd
nodejs
ipympl
postBuild file:
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyter-matplotlib
jupyter nbextension enable --py widgetsnbextension
Ultimately I’m trying to get an interactive notebook that already works fine in Jupyter Notebook to fully work in Jupyterlab and everything works in both except for the Matplotlib functionality. I’m wondering if anyone has any advice on why these issues occur and/or what changes I can make to my Binder installation files to enable correct functionality in JupyterLab. I’d like to think it’s possible somehow to run a Matplotlib animation in JupyterLab.
Thanks!