【问题标题】:How to install jupyterlab-plotly labextension using pip nodjs in a virtual environment?如何在虚拟环境中使用 pip nodjs 安装 jupyterlab-plotly labextension?
【发布时间】:2021-05-09 18:16:28
【问题描述】:

我正在尝试使用此命令(根据https://plotly.com/python/getting-started/)安装 jupyterlab plotly 扩展:

jupyter labextension 安装 jupyterlab-plotly@4.14.3

我收到此错误:

An error occured.
ValueError: Please install Node.js and npm before continuing installation. You may be able to install Node.js from your package manager, from conda, or directly from the Node.js website (https://nodejs.org).
See the log file for details:  /tmp/jupyterlab-debug-epx8b4n6.log

我没有在系统级别安装 Node.js,而是在使用 pip 的虚拟环境中安装。 Pip 列表同时显示 nodejs 0.1.1 和 npm 0.1.1 。我也在 jupyterlab 中使用 ipywidgets,它需要 nodejs 并且工作正常。

所以我有两个问题:

  1. 如何在虚拟环境中通过 pip nodejs 使用 plotlywidgets?
  2. pip nodejs和系统级Node.js有什么区别

【问题讨论】:

    标签: python node.js pip plotly jupyter-lab


    【解决方案1】:

    不,您没有安装了 node.js。您为节点安装了某种 Python 绑定(python-nodejs,其 repository 由作者存档),它本身需要一个实际的 nodejs。在不检查您正在安装的内容的情况下从 PyPI 安装东西是很危险的。它可能是一个恶意代码——你不应该只是在pip install 之后输入一个名字,然后希望它安装你的想法。你的npm安装也是一样(包来自同一作者);两者在过去 6 年内都没有更新,并且可能包含一些漏洞,所以我会快速卸载它们;)

    从版本号可以立即看出有问题,因为当前的nodejs版本一般>10,(确切的版本取决于你的JupyterLab版本,即10或12;14也可能工作)。

    【讨论】:

      【解决方案2】:

      首先安装nodejs最新版本 conda install nodejs -c conda-forge --repodata-fn=repodata.json

      然后安装 jupyterlab 扩展: jupyter labextension install jupyterlab-plotly@4.14.3

      然后重新启动 JUPYTER LAB

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-04-26
        • 1970-01-01
        • 2021-10-21
        • 2019-09-02
        • 1970-01-01
        • 2019-07-04
        • 2016-10-19
        • 1970-01-01
        相关资源
        最近更新 更多