pythonrequirejsplotlyjupyter-lab

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:


Solution

  • 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!