In Jupyter Notebook, ipywidgets work fine, however they seem to not work in Jupyter Lab (which is supposedly better than Notebook).
I followed these directions.
Had the same issue, and what worked for me today was running the 'clean' command, as mentioned here: https://ipywidgets.readthedocs.io/en/latest/user_install.html#installing-the-jupyterlab-extension
So:
jupyter lab clean
jupyter labextension install @jupyter-widgets/jupyterlab-manager
And that got it working right for me just now.
I have the same issue as @jtlz2 that none of the above suggestion works for me except @hainm's very specific version combination for jupyter-lab, ipywidgests, and jupyter-widgets/jupyterlab-manager.
Following the initial version numbers listed in this post (https://github.com/jupyter-widgets/ipywidgets/issues/2488#issuecomment-509719214), I tried to find the most updated version combination that works. I list them below, such that one can try it if there is really nothing else working for him/her.
pythonversion=3.8.0
labversion=2.1.5
labmanagerversion=2.0
ipywidgetsversion=7.5.1
nodejsversion=10.13.0
conda create -n lab python=$pythonversion -y
source activate lab
conda install nodejs=$nodejsversion -c conda-forge -y
conda install ipywidgets=$ipywidgetsversion -c conda-forge -y
conda install jupyterlab=$labversion -y -c conda-forge
jupyter-labextension install @jupyter-widgets/jupyterlab-manager@$labmanagerversion
It seems that the version of nodejs plays a key role. Holing everything else equal, if I update nodejsversion to 12.x+ or the latest 14.x, this combination as well as @hainm's combination both fail to make ipywidgets behave normally in Jupyterlab.
Other than the one I listed in the above code cell, below 6 combinations also work for me.
(pythonversion ,labversion ,labmanagerversion ,ipywidgets ,nodejsversion)
I had the same pbm, and tried this solution (hope it can help others):
The jupyter labextension install @jupyter-widgets/jupyterlab-manager
gave this kind of error in my case:
> /Users/user/.nvm/versions/node/v8.7.0/bin/npm pack @jupyter-widgets/jupyterlab-manager
jupyter-widgets-jupyterlab-manager-0.35.0.tgz
Errored, use --debug for full output:
ValueError:
"@jupyter-widgets/jupyterlab-manager@0.35.0" is not compatible with the current JupyterLab
Conflicting Dependencies:
JupyterLab Extension Package
>=0.15.4-0 <0.16.0-0 >=0.16.0-0 <0.17.0-0 @jupyterlab/application
>=1.1.4-0 <2.0.0-0 >=2.0.0-0 <3.0.0-0 @jupyterlab/services
>=0.15.4-0 <0.16.0-0 >=0.16.0-0 <0.17.0-0 @jupyterlab/rendermime
>=0.15.4-0 <0.16.0-0 >=0.16.0-0 <0.17.0-0 @jupyterlab/notebook
Then, what I did is to use a previous version 0.34 instead of 0.35:
jupyter labextension install @jupyter-widgets/jupyterlab-manager@0.34
In fact, according to this, sometime teams get time to consider the last version.
UP (according to comments):
You can check jupyter lab --version
and find match on its version compatibility.
And it works now !
According to ipywidgets.readthedocs.io documentation (Installing the JupyterLab Extension), for "JupyterLab" do the following steps in "Anaconda Prompt".
Step 1
conda install -c conda-forge nodejs
Step 2
jupyter labextension install @jupyter-widgets/jupyterlab-manager
None of the other answers worked to me. It all seems to be down to version compatibility. Finally got it working - see below. All credit to @hainm on github (original link: https://github.com/jupyter-widgets/ipywidgets/issues/2488#issuecomment-509719214) My SO answer on this: https://stackoverflow.com/a/60059786/1021819 Here is a straight copy of that answer:
Leveraging https://github.com/jupyter-widgets/ipywidgets/issues/2488#issuecomment-509719214, in a jupyterlab terminal - running on jupyterhub - execute:
pythonversion=3.7
labversion=0.34.12
labmanagerversion=0.37.4
ipywidgetsversion=7.4.2
conda install ipywidgets=$ipywidgetsversion -c conda-forge -y --override-channels -c main
conda install jupyterlab=$labversion -y -c conda-forge --override-channels -c main
jupyter-labextension install @jupyter-widgets/jupyterlab-manager@$labmanagerversion
At this point a jupyter lab clean; jupyter lab build
might be of interest.
Then in a .ipynb notebook running in the same jupyterlab window, hit the restart kernel button.
IMPORTANT: Don't forget to also REFRESH the browser page - or all efforts will have been in vain . :\
Then execute the example:
from ipywidgets import interact
@interact(x=(0, 100, 10))
def p(x=50):
pass
I never thought I would live to see the day but - hey presto - the widget finally appears!
The sad things are that the setup is extremely sensitive to the installation of other extensions and the combination of compatible versions is very specific.
I was getting a Permission Denied
error, so adding sudo
to the accepted command helped: sudo jupyter labextension install @jupyter-widgets/jupyterlab-manager
.