0 votes
50 views

Hi, I'm a TA in an undergraduate astronomy course, and we've been using these jupyterlab servers for the hands-on lectures.

This semester we've encountered that we can't use the interactive tool of matplotlib. The output just says "Error displaying widget".

Example code:

import matplotlib.pyplot as plt
%matplotlib widget

plt.figure()
plt.plot([0,1],[0,1])
plt.show()

I also tried installing ipympl and ipywidgets first, but it doesn't change anything.

!pip install ipywidgets
!pip install ipympl

Any help would be appreciated.

by guevaraene (170 points) | 50 views

1 Answer

0 votes
Best answer
We are aware of a few issues with the use of widgets in notebooks, but for this particular example try using:

%matplotlib inline

instead of 'widget'.  The ipywidgets/ipympl/etc packages are already installed and would require the use of 'inline' as well.  Let us know if you continue to have problems.
by datalab (20.7k points)
selected by 0
Thank you, yes, we've been using the inline backend. Is there any chance to fix the widget issue in the future?
Yes, we hope to get this resolved with the next update to our Python and Jupyter versions.

Please note that we also operate a new cloud-based version of the NB server, where I tried your minimal example (thank you for that!), and it works. Feel free to use that NB server, but please be aware that it's still "alpha", meaning things can change and break under your feet, and we don't guarantee any backups there (yet).

https://cloud.datalab.noirlab.edu

409 questions

426 answers

434 comments

630 users

Welcome to Data Lab Help Desk, where you can ask questions and receive answers from other members of the community.

Categories