Plotly is not working in Jupyterlab. I assume that there is a conflict in required extensions but I'm not sure. On checking troubleshooting on Plotly https://plotly.com/python/troubleshooting/ , they advise to remove extensions and install them again. But I found that there is additional extension that came with Jupyterlab update called ' jupyterlab-plotly-extension ' which is not mentioned by Plotly in their instructions to make it working in JupyterLab https://plotly.com/python/getting-started/#jupyterlab-support-python-35
My question is: which extensions should be installed to make Plotly working in JupyterLab?
You can install plotly using pip or conda:
pip install "plotly>=5" "ipywidgets>=7.6"
# or if using conda
# conda install -c plotly "plotly>=5"
# conda install "ipywidgets>=7.6"
Plotly comes with support for both the Jupyter Notebook and JupyterLab. There is no need to install anything else for JupyterLab 3.0 and newer. The widget package and the renderer package are both included in plotly
starting from v5.
For older versions of JupyterLab (1.x and 2.x) you will need a recent Node.js installed and install additional packages; do not run these commands if using newer version of JupyterLab:
pip install "ipywidgets>=7.5"
# renderer support
jupyter labextension install jupyterlab-plotly
# OPTIONAL: Jupyter widgets extension
jupyter labextension install @jupyter-widgets/jupyterlab-manager plotlywidget
Enter 'jupyter labextension list' in a terminal or command to run the environment status. The example below shows my environment information with 'jupyter lab' running successfully.
xxxxx-no-iMac:~ xxxxx$ jupyter labextension list
JupyterLab v2.1.5
Known labextensions:
app dir: /Library/Frameworks/Python.framework/Versions/3.6/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager v2.0.0 enabled OK
@jupyterlab/git v0.20.0 enabled OK
@lckr/jupyterlab_variableinspector v0.5.0 enabled OK
jupyterlab-plotly v1.5.4 enabled OK
nbdime-jupyterlab v2.0.0 enabled OK
plotlywidget v1.5.4 enabled OK
upyterLab Support (Python 3.5+) For use in JupyterLab, install the jupyterlab and ipywidgets packages using pip...
$ pip install jupyterlab "ipywidgets>=7.5" or conda.
$ conda install jupyterlab "ipywidgets=7.5" Then run the following commands to install the required JupyterLab extensions (note that this will require node to be installed):
jupyter labextension install jupyterlab-plotly@4.12.0
jupyter labextension install @jupyter-widgets/jupyterlab-manager plotlywidget@4.12.0
https://plotly.com/python/getting-started/#jupyterlab-support-python-35
Assuming that you have installed all the libraries correctly (make sure you have ipywidgets
and nodejs
installed) and assuming one is using conda
, access conda prompt
for the environment one is working (the "Server" environment).
Then, you will need to install the extension(s) jupyterlab-plotly
(the library nodejs
will be required now)
jupyter labextension install jupyterlab-plotly@4.14.3
and plotlywidget
[optional] - this one requires nodejs >=10.0.0
jupyter labextension install @jupyter-widgets/jupyterlab-manager plotlywidget@4.14.1
For a more detailed explanation, you may want to read my answer here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.