Reputation: 1023
I've tried both a simple inline tutorial and using the cookiecutter template to make Jupyter Widgets but the widgets don't load.
When I try this tutorial even for the hello world widget, I just get "A Jupyter Widget" printed out and in the console I get "404 GET /nbextensions/widgets/notebook/js/extension.js".
When I try an inline example, I get this error in the console "404 GET /static/@jupyter-widgets/base.js" The code for the inline examples is just
import ipywidgets as widgets
from traitlets import Unicode, validate
class HelloWidget(widgets.DOMWidget):
_view_name = Unicode('HelloView').tag(sync=True)
_view_module = Unicode('hello').tag(sync=True)
_view_module_version = Unicode('0.1.0').tag(sync=True)
%%javascript
require.undef('hello');
define('hello', ["@jupyter-widgets/base"], function(widgets) {
var HelloView = widgets.DOMWidgetView.extend({
// Render the view.
render: function() {
this.el.textContent = 'Hello World!';
},
});
return {
HelloView: HelloView
};
});
This is in a conda virtual environment, Jupyter 4.2.1 and Notebook 4.3.1
Thanks in advance for your help.
Upvotes: 1
Views: 1410
Reputation: 2896
Reinstall all jupyter and ipython related pip packages solved this problem for me.
Upvotes: 0
Reputation: 445
I've had the same issue when I forgot to run jupyter nbextension enable --py widgetsnbextension
after installing through pip
; see here for details http://ipywidgets.readthedocs.io/en/latest/user_install.html. Seems like conda
should have enabled the extension for you. I don't have any experience with conda
but seems like you could have installed ipywidgets
either via conda install -c anaconda ipywidgets
or conda install -c conda-forge ipywidgets
, think maybe the conda-forge
install could be more up-to-date?
Upvotes: 1