Skip to content

Unable to use both a built-in widget and a custom widget in JupyterLab #2053

Closed
@jonmmease

Description

@jonmmease

Background

I've been working on adding JupyterLab ipywidget support (In addition to the working notebook ipywidget support) to the this WIP plotly.py branch (plotly/plotly.py#942), and I'm running into a problem.

Problem (Bug?)

A custom-built local widget can't be displayed in the same jupyterlab notebook as a built-in widget provided by @jupyter-widgets/jupyterlab-manager

Simplified Example

Steps to reproduce

  1. Create a fresh conda environment for Python 3.6. Install jupyterlab into the environment using pip
$ conda create -n jupyterlab_widget python=3.6
$ source activate jupyterlab_widget
$ pip install jupyterlab
  1. Follow jupyter widget cookiecutter instructions here to create a new widget named jlwidget
$ pip install cookiecutter
$ cookiecutter https://github.com/jupyter/widget-cookiecutter.git
  1. Build the widget
$ cd jlwidget/
$ python setup.py build
$ pip install -e .
  1. Install widget for notebook
$ jupyter nbextension enable --py widgetsnbextension
$ jupyter nbextension install --py --symlink --sys-prefix jlwidget
$ jupyter nbextension enable --py --sys-prefix jlwidget
  1. Test in classic notebook. Create an IntSlider in the first cell and a HelloWorld widget in the second cell. Both display properly.
$ jupyter notebook

screen shot 2018-04-17 at 6 47 05 am

  1. Build/install for jupyterlab. Note: my understanding is that @jupyter-widgets/jupyterlab-manager needs to be installed to view any widgets in JupyterLab and to view the IntSlider
$ jupyter labextension install @jupyter-widgets/jupyterlab-manager
$ jupyter labextension install js
  1. Test in jupyterlab. Execute the same notebook shown above. The HelloWorld widget displays fine but there is an error displaying the IntSlider
$ jupyter lab

screen shot 2018-04-17 at 6 56 02 am

Here is the error in the chrome developer console

screen shot 2018-04-17 at 6 58 13 am

  1. Disable the jlwidget widget, and repeat the experiment. Now the IntSlider displays fine, and the HelloWorld widget does not (as I expected)
$ jupyter labextension disable jlwidget

screen shot 2018-04-17 at 7 01 21 am

screen shot 2018-04-17 at 7 02 42 am

Environment details

(jupyterlab_widget) measejm1@measejm1-ml1 ~/Programming/PyDataStack/repos/scratch/jlwidget $ conda list
# packages in environment at /Users/measejm1/anaconda/envs/jupyterlab_widget:
#
# Name                    Version                   Build  Channel
appnope                   0.1.0                     <pip>
arrow                     0.12.1                    <pip>
backcall                  0.1.0                     <pip>
binaryornot               0.4.4                     <pip>
bleach                    2.1.3                     <pip>
bqplot                    0.10.5                    <pip>
ca-certificates           2018.03.07                    0  
certifi                   2018.1.18                py36_0  
chardet                   3.0.4                     <pip>
click                     6.7                       <pip>
cookiecutter              1.6.0                     <pip>
decorator                 4.3.0                     <pip>
entrypoints               0.2.3                     <pip>
future                    0.16.0                    <pip>
html5lib                  1.0.1                     <pip>
idna                      2.6                       <pip>
ipykernel                 4.8.2                     <pip>
ipython                   6.3.1                     <pip>
ipython-genutils          0.2.0                     <pip>
ipywidgets                7.2.1                     <pip>
jedi                      0.12.0                    <pip>
Jinja2                    2.10                      <pip>
jinja2-time               0.2.0                     <pip>
jlwidget                  0.1.0a0                   <pip>
jsonschema                2.6.0                     <pip>
jupyter-client            5.2.3                     <pip>
jupyter-core              4.4.0                     <pip>
jupyterlab                0.32.0                    <pip>
jupyterlab-launcher       0.10.5                    <pip>
libcxx                    4.0.1                h579ed51_0  
libcxxabi                 4.0.1                hebd6815_0  
libedit                   3.1                  hb4e282d_0  
libffi                    3.2.1                h475c297_4  
MarkupSafe                1.0                       <pip>
mistune                   0.8.3                     <pip>
nbconvert                 5.3.1                     <pip>
nbformat                  4.4.0                     <pip>
ncurses                   6.0                  hd04f020_2  
notebook                  5.4.1                     <pip>
numpy                     1.14.2                    <pip>
openssl                   1.0.2o               h26aff7b_0  
pandas                    0.22.0                    <pip>
pandocfilters             1.4.2                     <pip>
parso                     0.2.0                     <pip>
pexpect                   4.5.0                     <pip>
pickleshare               0.7.4                     <pip>
pip                       9.0.3                    py36_0  
poyo                      0.4.1                     <pip>
prompt-toolkit            1.0.15                    <pip>
ptyprocess                0.5.2                     <pip>
Pygments                  2.2.0                     <pip>
python                    3.6.5                hc167b69_0  
python-dateutil           2.7.2                     <pip>
pytz                      2018.4                    <pip>
pyzmq                     17.0.0                    <pip>
readline                  7.0                  hc1231fa_4  
requests                  2.18.4                    <pip>
Send2Trash                1.5.0                     <pip>
setuptools                39.0.1                   py36_0  
simplegeneric             0.8.1                     <pip>
six                       1.11.0                    <pip>
sqlite                    3.22.0               h3efe00b_0  
terminado                 0.8.1                     <pip>
testpath                  0.3.1                     <pip>
tk                        8.6.7                h35a86e2_3  
tornado                   5.0.2                     <pip>
traitlets                 4.3.2                     <pip>
traittypes                0.0.6                     <pip>
urllib3                   1.22                      <pip>
wcwidth                   0.1.7                     <pip>
webencodings              0.5.1                     <pip>
wheel                     0.31.0                   py36_0  
whichcraft                0.4.1                     <pip>
widgetsnbextension        3.2.1                     <pip>
xz                        5.2.3                h0278029_2  
zlib                      1.2.11               hf3cbc9b_2  

Metadata

Metadata

Assignees

No one assigned

    Labels

    resolved-lockedClosed issues are locked after 30 days inactivity. Please open a new issue for related discussion.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions