12

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
Khris
  • 3,132
  • 3
  • 34
  • 54
  • 2
    Hello Khris, did you install Jupyter Lab's plotly extension? Unlike in Jupyter Notebook, plotly plots won't work directly in Jupyter Lab. You need to install his extension: https://github.com/jupyterlab/jupyter-renderers/tree/master/packages/plotly-extension – byouness Jan 14 '19 at 13:33
  • Hi byouness, I did not, thanks for telling me this. Sadly I can't install it, getting this error: `write EPROTO 1172:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:openssl\ssl\record\ssl3_record.c:252:`. I'm behind a company proxy, so that might be a reason. – Khris Jan 15 '19 at 14:15

2 Answers2

11

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!

pj.dewitte
  • 472
  • 3
  • 10
  • Thanks for the answer. I managed to configure the proxies but I'm still getting the wrong version error. The requirements say node.js > 5 and I have 10.15.0, so this makes no sense. I'll ask that question on their github. – Khris Jan 21 '19 at 06:55
  • 1
    Hello Khris. Great! If the only error you have is linked to node.js, then try using a node.js version previous to 10 (v8.9.3 for example). I believe there might be some issues with versions 10 and higher depending on the JupyterLab and plotly extension versions you're installing: https://github.com/jupyterlab/jupyterlab/issues/4986 – byouness Jan 21 '19 at 10:01
  • Many thanks for finding this, I will try with another version. – Khris Jan 21 '19 at 14:51
  • @byouness I did install v8.15.0 and now I'm getting a different error: `request to https://registry.npmjs.org/@jupyterlab%2fplotly-extension failed, reason: write EPROTO 101057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:827:`. Been looking through some threads like https://github.com/jspm/github/issues/59 and https://stackoverflow.com/questions/15421050/node-request-getting-error-ssl23-get-server-hellounknown-protocol and set strict-ssl to false, but that didn't solve it. Probably an issue with the company proxy server. – Khris Jan 22 '19 at 08:27
  • Too bad. I unfortunately can't help with this. I hope @pj.dewitte who did a similar installation behind a company proxy wll be able to help! – byouness Jan 22 '19 at 09:02
  • Sorry no, this is beyond my knowledge and experience... Thinking out of the box: is it possible to take the computer/laptop out of the firewall zone (e.g. use your phone as a hotspot)? Another exotic idea, is to do the install on another computer, and copy the installation via a memory stick. – pj.dewitte Jan 22 '19 at 09:25
  • at the moment extension link mentioned returns 404 – Dima Fomin Oct 08 '19 at 11:57
3

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.

Yan Ulm
  • 33
  • 3