Maddy
Maddy

Reputation: 146

Cannot import widget from IPython.html.widgets in Jupyter notebook

I am using Jupyter to run my code.

from Ipython.html.widgets import interact, ButtonWidget
from IPython.display import display, clear_output

I am not getting the following error for that:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-6-3fa9b991f293> in <module>()
----> 1 from IPython.html.widgets import interact, ButtonWidget
  2 from IPython.display import display, clear_output

ModuleNotFoundError: No module named 'widgets'

I tried to replace IPython.html.widgets to ipywidgets and execute it. It threw me back:

from ipywidgets import interact, ButtonWidget

ImportError: cannot import name ButtonWidget"

Upvotes: 2

Views: 2962

Answers (1)

Mike M&#252;ller
Mike M&#252;ller

Reputation: 85432

These objects have moved with some renaming:

from ipywidgets import interact, Button

Upvotes: 3

Related Questions