No module named 'ipywidgets' error when running IPyhon.widgets
23,601
Solution 1
Between IPython 3 and IPython 4, a number of components were split into separate packages (http://blog.jupyter.org/2015/04/15/the-big-split/). 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.
Solution 2
ipywidgets is not installed with IPython. Just install it.
pip install ipywidgets
Author by
Yashu Seth
Updated on July 11, 2022Comments
-
Yashu Seth almost 2 years
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?