Plotly 3.0.0 with JupyterLab not displaying plot


#1

When I recently tried plotly 3.0.0 with JupyterLab 0.32.1 by running the following code,

import plotly.graph_objs as go
import numpy as np
x = np.random.randn(1000)
y = np.random.randn(1000)
go.FigureWidget(data=[{'x': x, 'y': y, 'type': 'histogram2dcontour'}])

the plot was not displayed and I received an “Error displaying widget” message. I have jupyterlab-manager 0.35.0 and plotly-extension 0.16.0 installed; I do not have plotlywidget installed (attempting to install it resulted in an error). Any thoughts as to why the plot is not being displayed? I can see the plot if I run the above code in a plain Jupyter notebook.


#2

Hey @lebedov

I ran the below and it worked for me. If you get an error running any of the below or it doesn’t work, what error are you getting?

jupyter labextension install @jupyter-widgets/jupyterlab-manager 
jupyter labextension install plotlywidget@0.1.1

Also, whilst not JupyterLab you may find this thread and the provided link in the thread helpful.


#3

I already have ipywidgets 7.2.1 installed.

Attempting to install plotlywidget 0.1.1 results in the following error:

(snip)
> node /home/lebedov/miniconda3/lib/python3.6/site-packages/jupyterlab/staging/yarn.js run build:prod                                                                                            
yarn run v1.5.1
$ webpack --config webpack.prod.config.js
internal/modules/cjs/loader.js:550
throw err;
^

Error: Cannot find module 'plotlywidget/package.json'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15)
at Function.resolve (internal/modules/cjs/helpers.js:18:19)
at /home/lebedov/miniconda3/share/jupyter/lab/staging/node_modules/@jupyterlab/buildutils/lib/build.js:22:43                                                                                 
at Array.forEach (<anonymous>)
at Object.ensureAssets (/home/lebedov/miniconda3/share/jupyter/lab/staging/node_modules/@jupyterlab/buildutils/lib/build.js:21:22)                                                           
at Object.<anonymous> (/home/lebedovk/miniconda3/share/jupyter/lab/staging/webpack.config.js:19:7)                                                                                            
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Module.require (internal/modules/cjs/loader.js:598:17)
at require (internal/modules/cjs/helpers.js:11:18)
at Object.<anonymous> (/home/lebedov/miniconda3/share/jupyter/lab/staging/webpack.prod.config.js:5:14)                                                                                       
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
error An unexpected error occurred: "Command failed.
Exit code: 1

Not sure if it matters, but I also have node 9.11.1 installed.


#4

Removing plotly-extension appears to solve the problem.