Issue
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?
Solution
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.
Answered By - Eric G.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.