Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

widget javascript not installed message appears often #1211

Closed
jasongrout opened this issue Mar 18, 2017 · 4 comments · Fixed by #1219
Closed

widget javascript not installed message appears often #1211

jasongrout opened this issue Mar 18, 2017 · 4 comments · Fixed by #1219
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Milestone

Comments

@jasongrout
Copy link
Member

jasongrout commented Mar 18, 2017

The python error message "Widget Javascript not detected. It may not be installed or enabled properly." appears a lot, and has been pretty fickle about appearing for a long time. Let's figure out why and fix the version check.

(Moved from jupyter/notebook#2087)

CC @SylvainCorlay

@jasongrout
Copy link
Member Author

Okay, here's a possible sequence. I haven't tested this.

In notebook 4.4.1 or 5.0:

  1. The notebook launches
  2. The user quickly presses shift-enter to execute a cell that has widget code.
  3. The cell is queued up for execution
  4. The widget javascript is loaded. When the widget javascript is loaded, it immediately sends a comm message to the kernel with the version information, etc. This is comm message is queued behind the cell execution. (TODO: Check that the comm open message to jupyter.widget.version is queued behind the cells)
  5. The kernel starts up.
  6. The cell is executed. Since the kernel widgets has not seen the comm message from the javascript, it assumes there is no widget javascript and so prints an error message: "Widget Javascript not detected. It may not be installed or enabled properly."

Basically, it's a race condition between the widget javascript running before the user executes a cell, and an assumption from the kernel side that the ipywidgets will be able to execute a comm open before any user code runs.

Before jupyter/notebook#1002, here's what I am thinking was happening in the situations where the message seemed to randomly pop up.

  1. The notebook launches
  2. The user quickly presses shift-enter to execute a cell that has widget code.
  3. The execution is silently ignored since the kernel is not up yet.
  4. The widget javascript is loaded. When the widget javascript is loaded, it immediately sends a comm message to the kernel with the version information, etc. This is also silently ignored!
  5. The kernel starts up.
  6. Another cell is executed. Since the kernel widgets has not seen the comm message from the javascript, it assumes there is no widget javascript and so prints an error message: "Widget Javascript not detected. It may not be installed or enabled properly."

It always seemed fickle when the 'js not installed' error came up.

I think the real problem is that in ipywidgets, we are assuming that the widget javascript will have priority access to a kernel, before user execution. I think we probably need a more robust method for doing the version check.

And clearly this ipywidget check is faulty if we have multiple clients talking to the same kernel. The first client will okay its version of javascript, so the error won't show if the second client does not have the javascript installed.

@ialxn
Copy link

ialxn commented Mar 24, 2017

I am getting these warnings quite regularly too when using hyperspy in an Ipython console of spyder.

In [199]: P = s.find_peaks1D_ohaver(maxpeakn=1)[0]
Widget Javascript not detected. It may not be installed or enabled properly.

The same in a Jupyter Notebook:

jupyter nbextension enable --py --sys-prefix widgetsnbextension
Enabling notebook extension jupyter-js-widgets/extension...
- Validating: OK

And then in the Notebook itself:

In[1] :
import hyperspy.api as hs
s = hs.datasets.example_signals.EDS_TEM_Spectrum()
P = s.find_peaks1D_ohaver()[0]

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

I am using a Conda installation on an Ubuntu 16.04 system and installed hyperspy from conda-forge.

uname -a
Linux PC12348 4.4.0-66-generic #87-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux

conda list (excerpt):
hyperspy 1.2 py36_0 conda-forge
ipykernel 4.5.2 py36_0
ipython 5.3.0 py36_0
ipython_genutils 0.1.0 py36_0
ipywidgets 6.0.0 py36_0

Does this concern this issue (should be fixed in a next release or am I reading this wrong) or is this a Conda/Anaconda issue?

@jasongrout
Copy link
Member Author

I've removed that message from the next version of ipywidgets. It is a bit concerning that it was appearing in spyder - that indicates that there still might be a problem with hyperspy. Do you expect any widgets to be used in the commands that you did above?

@aishenri
Copy link

I have it in k3d-jupyter
plot.display()
could not create model:
Model name K3DModel
Model module k3d
Model module version ^2.0.0
Script error for "k3d" http://requirejs.org/docs/errors.html#scripterror

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

@jasongrout jasongrout added this to the 7.0 milestone Aug 4, 2017
@github-actions github-actions bot added the resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion. label Feb 11, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolved-locked Closed issues are locked after 30 days inactivity. Please open a new issue for related discussion.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants