17

Question: I installed python3 and jupyter notebook using pip3 in MacOs 10.9.
When I try to run the widget it gives error that there is no javascript widget. I have python3 and R kernels installed in Jupyter-notebook.

Code:

from ipywidgets import widgets
from IPython.display import display
text = widgets.Text()
display(text)
text.on_submit('hello')

Error:

Widget Javascript not detected. It may not be installed or enabled properly. 

Attempts:

sudo -H pip3 install ipywidgets 
sudo -H pip3 install --upgrade ipywidgets 
jupyter nbextension enable --py widgetsnbextension
# restarted the computer. 

The last command gives error.

[EnableNBExtensionApp] CRITICAL | Bad config encountered during initialization:
[EnableNBExtensionApp] CRITICAL | Unrecognized flag: '--py'

Note that in mac I have jupyter-nbextension command but the command:

jupyter-nbextension enable --py widgetsnbextension 

does not work either.

But jupyter nbextension enable widgetsnbextension gives no error and also does nothing. The same error is popped in if I run the code.

Also,

import ipywidgets
ipywidgets.__version__

gives '6.0.0'.

Some notes:

which jupyter 
jupyter is /Library/Frameworks/Python.framework/Versions/3.5/bin/jupyter
which jupyter-notebook
jupyter-notebook is /Library/Frameworks/Python.framework/Versions/3.5/bin/jupyter-notebook

Related links:

https://github.com/jupyter-widgets/ipywidgets/issues/541 
https://github.com/jupyter/help/issues/32 
https://github.com/jupyter/help/issues/131 
https://github.com/binder-project/binder/issues/83 

How can I install widgets?
Do I need to install java separately ?

Yonas Kassa
3,7881 gold badge23 silver badges27 bronze badges
asked May 3, 2017 at 20:06
1

6 Answers 6

11

Run the following command: jupyter nbextension enable --py --sys-prefix widgetsnbextension, then restart the kernel in Jupyter should do the trick.

answered May 5, 2017 at 6:35
Sign up to request clarification or add additional context in comments.

4 Comments

Enabling notebook extension is SUCCESSFUL, but , however, the module widgets still gives the error: Widget Javascript not detected. It may not be installed or enabled properly. Can we also solve WIDGETS problem???
Your not just missing the ipywidgets? Try installing it by running: pip install ipywidgets
Thanks @chjortlund, pip install ipywidgets helped for me
This works for python 3.10 with NO anaconda.
5

The answer from chjortlund did not work for me because I don't have root rights. This solved it for me:

pip3 install --upgrade ipywidgets
jupyter nbextension enable --py widgetsnbextension
AlexK
3,0119 gold badges19 silver badges29 bronze badges
answered Sep 21, 2022 at 13:48

Comments

3

I used the following commands successfully with Jupyter, Mac OS, Python 3.6, and Anaconda. The first command gets the latest version of ipywidgets at this time (version 7.0).

conda install -c conda-forge ipywidgets
jupyter nbextension enable --py widgetsnbextension
answered Sep 18, 2017 at 23:31

1 Comment

Indeed, the conda-forge version of ipywidgets is newer and this solves the problem in my case.
1

This solved it for me:

jupyter labextension install @jupyter-widgets/jupyterlab-manager
answered Feb 12, 2018 at 13:54

Comments

0

I faced the same problem and after running the command:jupyter nbextension enable --py --sys-prefix widgetsnbextension, the prompt should appear:

>Enabling notebook extension jupyter-js-widgets/extension...

- Validating: ok. Refresh your jupyter notebook and the widgets worked.

answered Aug 2, 2017 at 18:54

Comments

0

Probably the best way, at least it worked for me: reinstall the ipywidgets and widgetsextension and it should work.

pip uninstall ipywidgets widgetsnbextension
pip install ipywidgets
jupyter nbextension enable --py --sys-prefix widgetsnbextension
answered Sep 26, 2017 at 11:11

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.