7

I'm running a jupyter notebook but the jupyter widgets does not appear. Instead I receive the folllowing message:

Failed to display Jupyter Widget of type Button.
If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean that the widgets JavaScript is still loading. If this message persists, it likely means that the widgets JavaScript library is either not installed or not enabled. See the Jupyter Widgets Documentation for setup instructions.
If you're reading this message in another frontend (for example, a static rendering on GitHub or NBViewer), it may mean that your frontend doesn't currently support widgets.

I have the following versions:

widgetsnbextension (3.0.8)
ipywidgets (7.0.5)

I installed the widgets with this command:

pip install ipywidgets
jupyter nbextension enable --py widgetsnbextension

Also my code is:

import ipywidgets as widgets
from IPython.display import display

button = widgets.Button(description='Hello')
display(button)
Daniel Zapata
  • 812
  • 3
  • 9
  • 31

1 Answers1

8

I have same versions and code works form me. BEFORE start jupyter notebook. Do you try execute?:

jupyter nbextension enable --py widgetsnbextension --sys-prefix

Output ==>

Enabling notebook extension jupyter-js-widgets/extension...
         - Validating: ok

** http://ipywidgets.readthedocs.io/en/stable/user_install.html shows the installation instructions with pip. Specifies that this mode be used when using virtual environments.

enter image description here

MarianD
  • 13,096
  • 12
  • 42
  • 54
otromas
  • 159
  • 3
  • It looks like in the question, the OP put the same line, just without the "--sys-prefix" section. Are you saying that they need to include that particular parameter, and that will fix the issue? – Taegost Nov 28 '17 at 19:10
  • At least for me, adding "--sys-prefix" solved the problem. – Sztyler Jul 11 '22 at 13:49