【问题标题】:Jupyterlab and Plotly offline: requirejs is not definedJupyterlab 和 Plotly 离线:requirejs 未定义
【发布时间】:2019-06-06 12:03:35
【问题描述】:

我使用 conda 安装了 plot.ly 并尝试在 Jupyterlab 上以离线模式使用它:

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

Firefox 开发者控制台在这些语句之后显示以下错误:

ReferenceError: requirejs is not defined

我尝试手动将require.js放入笔记本所在的文件夹,再放入...\anaconda3\pkgs\jupyter\nbextensions,没有成功。

我该如何解决这个问题?如何正确安装 require.js?

版本:

  • Python 3.6.6
  • 情节 3.4.2
  • Jupyterlab 0.35.4
  • Windows 10
  • 火狐 64.0.2
  • nodejs 10.15.0

【问题讨论】:

  • 你好 Khris,你安装了 Jupyter Lab 的 plotly 扩展吗?与 Jupyter Notebook 不同,绘图不能直接在 Jupyter Lab 中工作。你需要安装他的扩展:github.com/jupyterlab/jupyter-renderers/tree/master/packages/…
  • 嗨,byouness,我没有,谢谢你告诉我这个。遗憾的是我无法安装它,出现此错误:write EPROTO 1172:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:openssl\ssl\record\ssl3_record.c:252:。我支持公司代理,所以这可能是一个原因。

标签: python requirejs plotly jupyter-lab


【解决方案1】:

请参阅Yan Ulms 答案:Jupyter Lab 的 plotly 扩展已弃用


旧答案:

您需要安装@byouness 提到的plotly extension for Jupyter Lab

安装中的一个常见缺陷是您需要安装最新的 Node.js。这可能是您的错误write EPROTO 1172:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:openssl\ssl\record\ssl3_record.c:252 的原因。重新安装 Node.js 可能很容易解决。

您公司的防火墙可能确实有问题。因为扩展的安装使用 NPM(node.je 包管理器),你应该检查Common proxy and networking problems 的 NPM。您可能需要按照installation instructions for developers 手动安装扩展。

我绝对同意这个过程比它应该的要困难得多。在我的公司安装它也是一场斗争。祝你好运!

【讨论】:

  • 感谢您的回答。我设法配置了代理,但我仍然收到错误的版本错误。要求说 node.js > 5 而我有 10.15.0,所以这没有任何意义。我会在他们的 github 上问这个问题。
  • 你好克里斯。伟大的!如果您遇到的唯一错误与 node.js 相关联,请尝试使用 10 之前的 node.js 版本(例如 v8.9.3)。我相信版本 10 及更高版本可能存在一些问题,具体取决于您安装的 JupyterLab 和 plotly 扩展版本:github.com/jupyterlab/jupyterlab/issues/4986
  • 非常感谢您找到这个,我会尝试另一个版本。
  • @byouness 我确实安装了 v8.15.0,但现在我遇到了另一个错误: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:。一直在查看诸如github.com/jspm/github/issues/59stackoverflow.com/questions/15421050/… 之类的线程并将strict-ssl 设置为false,但这并没有解决问题。可能是公司代理服务器的问题。
  • 太糟糕了。不幸的是,我对此无能为力。我希望在公司代理后面进行类似安装的@pj.dewitte 能够提供帮助!
【解决方案2】:

GitHub 上的 JupyterLab 自述文件称 @jupyterlab/plotly-extension 已被弃用。请使用 Plotly 支持的 jupyterlab-plotly。请参阅plotly.py README 了解更多信息。

【讨论】:

    猜你喜欢
    • 2016-01-21
    • 1970-01-01
    • 1970-01-01
    • 2020-05-15
    • 2013-08-07
    • 1970-01-01
    • 2019-01-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多