Baby steps to get Plotly running in Jupyter Lab

Trying to get Plotly running in a fresh install of Jupyter Lab. Being pretty unfamiliar with the entire Jupyter/Conda/Python ecosystem I’m getting lost in all the different install instructions.

Is there a chance someone could help me walk through my install to make sure I have everything installed correctly before I move on to figuring out what might be wrong with my syntax.

The steps I followed (from the site)
(from within Anaconda 3 prompt)

conda install jupyterlab=1.0 "ipywidgets>=7.5"
set NODE_OPTIONS=--max-old-space-size=4096
jupyter labextension install @jupyter-widgets/jupyterlab-manager@1.0 --no-build
jupyter labextension install jupyterlab-plotly@1.1.0 --no-build
jupyter labextension install plotlywidget@1.1.0 --no-build
jupyter labextension install jupyterlab-chart-editor@1.2 --no-build
jupyter lab build
set NODE_OPTIONS=
jupyter lab
  • New Notebook - Python 3
import plotly.graph_objects as go
fig = go.Figure(data=go.Bar(y=[2, 3, 1]))
fig.show()

Result is big blank block

Here is my output from labextensions list

JupyterLab v1.0.10
Known labextensions:
app dir: C:\ProgramData\Anaconda3\share\jupyter\lab
@jupyter-widgets/jupyterlab-manager v1.0.2 enabled ok
@jupyterlab/dataregistry-extension v2.2.2 enabled ok
jupyterlab-chart-editor v1.2.0 enabled ok
jupyterlab-plotly v1.1.0 enabled ok
jupyterlab_voyager v1.0.2 enabled ok
plotlywidget v1.1.0 enabled ok

Chrome Version 77.0.3865.75 (Official Build) (64-bit)
Windows 10

My frustration comes from going through these steps and then copying and pasting the simple examples from https://plot.ly/python/getting-started/#jupyterlab-support-python-35 and still not getting anything rendered. A big blank output block appears but nothing renders. I’ve tried to go through the post where people had similar issue with plots not rendering but none of the items discussed seemed to help.

Much appreciation in advance

-Andy

I spent 2 hours trying to figure it out this problem with the most recent jupyterlab/plotly quick start guide (https://plot.ly/python/getting-started/). What actually worked for me: use fig=FigureWidget() instead of Figure(). And also in order to display the image call fig only, not fig.show()

1 Like

This needs an update.

The latest installation instructions are always at https://plot.ly/python/getting-started/ (updated whenever there is an update) and we also have a troubleshooting guide here https://plot.ly/python/troubleshooting/ if you run into problems :slight_smile:

I am trying to install based on the latest instructions, and I get this error in the logs. On the command prompt, it says that ValueError:jupyter-plotly@4.14.3 is not a valid npm package. It does seem to try to download the package, however, as shown below:

npm -v returns:
The system cannot find the path specified.
The system cannot find the path specified.
6.14.10

log:

> "C:\Program Files\nodejs\npm.CMD" pack jupyterlab-plotly@4.14.3
The system cannot find the path specified.
The system cannot find the path specified.
npm notice 
npm notice package: jupyterlab-plotly@4.14.3
npm notice === Tarball Contents === 
npm notice 545B  style/index.css                      
npm notice 6.3kB dist/javascript-renderer-extension.js
npm notice 1.0kB package.json                         
npm notice 156B  README.md                            
npm notice 1.0kB style/plotly.svg                     
npm notice === Tarball Details === 
npm notice name:          jupyterlab-plotly                       
npm notice version:       4.14.3                                  
npm notice filename:      jupyterlab-plotly-4.14.3.tgz            
npm notice package size:  3.1 kB                                  
npm notice unpacked size: 9.1 kB                                  
npm notice shasum:        bb424a50226c2ce1b816f061a8123f0f42418fc0
npm notice integrity:     sha512-6ZdmIQ5fDiBTY[...]nASwRNCf1U1Cg==
npm notice total files:   5                                       
npm notice 
jupyterlab-plotly-4.14.3.tgz

Traceback (most recent call last):

  File "C:\OneDrive\Portable Apps\Python 3.9 2021-0114\WPy64-3910\python-3.9.1.amd64\lib\site-packages\jupyterlab\debuglog.py", line 47, in debug_logging
    yield

  File "C:\OneDrive\Portable Apps\Python 3.9 2021-0114\WPy64-3910\python-3.9.1.amd64\lib\site-packages\jupyterlab\labextensions.py", line 93, in start
    ans = self.run_task()

  File "C:\OneDrive\Portable Apps\Python 3.9 2021-0114\WPy64-3910\python-3.9.1.amd64\lib\site-packages\jupyterlab\labextensions.py", line 138, in run_task
    return any([

  File "C:\OneDrive\Portable Apps\Python 3.9 2021-0114\WPy64-3910\python-3.9.1.amd64\lib\site-packages\jupyterlab\labextensions.py", line 139, in <listcomp>
    install_extension(

  File "C:\OneDrive\Portable Apps\Python 3.9 2021-0114\WPy64-3910\python-3.9.1.amd64\lib\site-packages\jupyterlab\commands.py", line 388, in install_extension
    return handler.install_extension(extension, pin=pin)

  File "C:\OneDrive\Portable Apps\Python 3.9 2021-0114\WPy64-3910\python-3.9.1.amd64\lib\site-packages\jupyterlab\commands.py", line 603, in install_extension
    info = self._install_extension(extension, tempdir, pin=pin)

  File "C:\OneDrive\Portable Apps\Python 3.9 2021-0114\WPy64-3910\python-3.9.1.amd64\lib\site-packages\jupyterlab\commands.py", line 1499, in _install_extension
    info = self._extract_package(extension, tempdir, pin=pin)

  File "C:\OneDrive\Portable Apps\Python 3.9 2021-0114\WPy64-3910\python-3.9.1.amd64\lib\site-packages\jupyterlab\commands.py", line 1578, in _extract_package
    raise ValueError(msg % source)

ValueError: "jupyterlab-plotly@4.14.3" is not a valid npm package

Exiting application: jupyter