Reputation: 31
I have a problem that interactive objects from ipywidgets
do not work in Jupyter Notebook on my computer. The widget itself is displayed but the function that it should control (e.g. drawing graph with changing parameter), seemingly, does not run. I took example from documentation and it does not work.
The picture of code and output
Code:
import ipywidgets
import widgetsnbextension
def greeting(text="World"):
print("Hello {}".format(text))
ipywidgets.interact(greeting, text="IPython Widgets")
What have I already tried:
jupyter nbextension enable --py widgetsnbextension
).ipython
and ipykernel
(packages ipywidgets
and widgetsnbextensions
were of the same version as mine). But it has led to errors so I have given up this idea. I have the latest versions of all packages now and I don't have Anaconda.What should I try next? May be I am wrong and the problem has a different cause?
Upvotes: 1
Views: 1840
Reputation: 31
I found the answer!!!
I have had several nbextensions
switched on (see screenshot). This was my mistake to include everything which seemed useful. When I turned off all nbextensions
then all ipywidgets
stuff started to work. Finally, I found that one particular extension called Limit Output is to be blamed for. Turn it off and all works fine.
The moral: don't use everything if you don't need it. Also, obviously, there is a bug in Limit Output extension because it is not supposed to affect widgets (it is supposed to limit output data when you accidentally write while(true)
or something like that).
You can read some useful stuff about SageMath in the comments under the original question as well.
Upvotes: 2