No Module Named 'Ipywidgets' Error When Running Ipyhon. Widgets [Closed]

I have IPython 4.0.1 installed. I cannot figure out the cause of the following error -

>>> from IPython.html import widgets
>>> k = widgets.Box
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\IPython\utils\shimmodule.py", line 90, in __getattr__
    return import_item(name)
  File "C:\Python34\lib\site-packages\IPython\utils\importstring.py", line 31, in import_item
    module = __import__(package, fromlist=[obj])
ImportError: No module named 'ipywidgets'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    k = widgets.Box
  File "C:\Python34\lib\site-packages\IPython\utils\shimmodule.py", line 92, in __getattr__
    raise AttributeError(key)
AttributeError: Box

How can I fix this?

2

Between IPython 3 and IPython 4, a number of components were split into separate packages (). Widgets were one of the features effected.

You can install ipywidgets through the standard channels (as Yashu Seth suggests):

pip install ipywidgets
# or
conda install ipywidgets

And you should get in the habit of not importing widgets from IPython.html, since the old library structure is being deprecated.

ipywidgets is not installed with IPython. Just install it.

pip install ipywidgets
Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest