Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jupyterlab and Plotly offline: requirejs is not defined

I installed plot.ly using conda and tried to use it in offline mode on Jupyterlab:

from plotly.offline import init_notebook_mode
init_notebook_mode(connected=True)

The Firefox developer console displays the following error after those statements:

ReferenceError: requirejs is not defined

I tried to manually put require.js into the folder with the notebook and into ...\anaconda3\pkgs\jupyter\nbextensions, it didn't work.

How do I solve this issue? How do I install require.js properly?

Versions:

  • Python 3.6.6
  • Plotly 3.4.2
  • Jupyterlab 0.35.4
  • Windows 10
  • Firefox 64.0.2
  • nodejs 10.15.0
like image 754
Khris Avatar asked Jan 11 '19 14:01

Khris


2 Answers

Please see Yan Ulms answer: the plotly extension for Jupyter Lab is deprecated


Old answer:

You need to install the plotly extension for Jupyter Lab, as mentioned by @byouness.

A common pitfall in the installation is that you need to have a recent Node.js installation. This might be the cause of your error write EPROTO 1172:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:openssl\ssl\record\ssl3_record.c:252. Re-installing Node.js might be an easy fix.

Your company firewall might indeed be a problem. Because the installation of the extension uses NPM (node.je package manager), you should check Common proxy and networking problems for NPM. You might need to install the extension manually, by following the installation instructions for developers.

I definitely agree that the process is much more difficult than it should be. Installing it at my company was also a struggle. Good luck!

like image 55
pj.dewitte Avatar answered Oct 04 '22 20:10

pj.dewitte


The JupyterLab readme on GitHub says that the @jupyterlab/plotly-extension is being deprecated. Please use the Plotly-supported jupyterlab-plotly. See the plotly.py README for more info.

like image 39
Yan Ulm Avatar answered Oct 04 '22 21:10

Yan Ulm