Ipywidgets: Question: ipywigets and conda environments

Created on 6 Oct 2017  路  8Comments  路  Source: jupyter-widgets/ipywidgets

Hi,
I have a simple question. I am using anaconda with jupyter notebook installed in the root environment and several environments for different projects, each offering a different kernel.

If I want to use ipywidgets, should I install it in the root environment, or the kernel environment?

Most helpful comment

There are two parts to ipywidgets. The python package ipywidgets needs to be installed in the kernel. The widgetsnbextension python package provides the javascript, and needs to be installed in the jupyter notebook server (and hence that environment).

If I understand your setup correctly, in the root environment, install widgetsnbextension and do jupyter nbextension enable --sys-prefix --py widgetsnbextension. In each kernel, install ipywidgets.

All 8 comments

There are two parts to ipywidgets. The python package ipywidgets needs to be installed in the kernel. The widgetsnbextension python package provides the javascript, and needs to be installed in the jupyter notebook server (and hence that environment).

If I understand your setup correctly, in the root environment, install widgetsnbextension and do jupyter nbextension enable --sys-prefix --py widgetsnbextension. In each kernel, install ipywidgets.

@jasongrout, thanks for the clarification. Is there a version lock between the widgetsnbextension in the root environment and ipywidgets in the kernel environment? Should I always update them at the same time?

It is probably unrelated but, right now ipywigets are not working on my system, they use to work a few months ago. I installed ipywidgets both in the root environment (is installed by default) and in the kernel environment. ipywidget depends on widgetsnbextension, so the latter is installed both on the root in a in the kernel environment.

The root environment has:

    ipywidgets: 7.0.0-py35hb70205d_0
    widgetsnbextension:  3.0.2-py35hdbe965d_1

Trying to nail down the problem, even if I use the kernel in the root environment, ipywidgets doesn't work. For example the "Using interact" example shows this:

screen shot 2017-10-06 at 1 52 28 pm

and no slider.

widgetsnbextension 3.x works with ipywidgets 7.x; widgetsnbextension 2.x works with ipywidgets 6.x.

Make sure that you do the jupyter nbextension enable --py --sys-prefix widgetsnbextension step in the notebook server environment to get widgets working.

Oh, thanks, I forgot to do the jupyter nbextension enable! In the past all the installation was performed by the conda package.

Anyway, your command didn't worked, then I tried:

jupyter nbextension enable --py widgetsnbextension

and widgets are now working again.

It sounds like at some point widgets was installed at the user level rather than the sys-prefix level. Glad you got it working!

Hi Jason, is there a place in the documentation for jupyter / ipywidgets / conda you could point to for understanding how these pieces interact better? I find myself frequently getting tripped up with these when installing on new computers or trying to update the various components.

Thanks!

http://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Distributing%20Jupyter%20Extensions%20as%20Python%20Packages.html has some docs, but it is more developer-focused. We have basic install instructions in ipywidgets, but we don't go into details. I think there is probably lots of instances of this sort of information scattered across issues where we've helped people.

So -- I think you have a good point: at least I don't know of a good place for user-focused documentation on notebook nbextensions.

I filed https://github.com/jupyter/notebook/issues/3445 to address the nbextension docs better.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fses91 picture fses91  路  6Comments

kennethjmyers picture kennethjmyers  路  3Comments

nickpollari picture nickpollari  路  5Comments

SimonEnsemble picture SimonEnsemble  路  5Comments

kebwi picture kebwi  路  6Comments