No module named 'ipywidgets' error when running IPyhon.widgets [closed]
Matthew Harrington
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: BoxHow can I fix this?
22 Answers
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 ipywidgetsAnd 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