Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IPython Notebook ipywidgets does not show

I created a table with an interactive slider that allows me to toggle between different periods on my table. It was working for the past few days, until today, when I re-ran the notebook, the slide bar doesn't show anymore. No error messages appear. The code seem to run just fine, as the table appears, but the slide bar just doesn't appear. I didn't change my code either, as I was working on a separate part of my notebook.

I tried many approaches, including searching in this space but was still unable to come up with a solution. I was wondering if anyone faced a similar issue, and have any solution to this.

Below is my code snippet. Anything before was solely to get my data into the desired form for tabulation.

from IPython.display import display from ipywidgets import widgets, interactive v = interactive(by_q, quarter=(['q1y2015', 'q2y2015', 'q3y2015', 'q4y2015']), days=(1, 180)) display(v) 
like image 990
Cliff Chew Avatar asked Apr 01 '16 08:04

Cliff Chew


People also ask

How do I enable Ipywidgets in Jupyter Notebook?

Simply install the python ipywidgets package with pip (pip install ipywidgets==7.6. 0) or conda/mamba (conda install -c conda-forge ipywidgets=7.6. 0) and ipywidgets will automatically work in classic Jupyter Notebook and in JupyterLab 3.0.

How do I enable autocomplete in Jupyter Notebook?

To enable code autocomplete in Jupyter Notebook or JupyterLab, you just need to hit the Tab key while writing code. Jupyter will suggest a few completion options. Navigate to the one you want with the arrow keys, and hit Enter to choose the suggestion.

How do I display an image in IPython notebook?

When using GenomeDiagram with Jupyter (iPython), the easiest way to display images is by converting the GenomeDiagram to a PNG image. This can be wrapped using an IPython. display. Image object to make it display in the notebook.

What is Python Ipywidgets?

IPyWidgets is a Python library of HTML interactive widgets for Jupyter notebook. Each UI element in the library can respond to events and invokes specified event handler functions. They enhance the interactive feature of Jupyter notebook application.


1 Answers

With the new version of ipywidgets, I ran into this problem, but then I found on their github readme that you now need to follow

pip install ipywidgets 

with

jupyter nbextension enable --py widgetsnbextension 

Note: To those using virtual environments (including conda environments) the recommended way to activate the extension is to run

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

That cleared the problem up for me.

like image 159
Elaine Hale Avatar answered Sep 21 '22 03:09

Elaine Hale