如何在虚拟环境中使用pip nodejs安装jupyterlab-plotly labextension ?



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

)jupiter labextension install 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的plot widgets ?
  2. pip nodejs和系统级Node.js有什么区别

没有,你有不是安装的node . js。您为node安装了某种Python绑定(Python -nodejs,其存储库由作者存档),它本身需要一个实际的nodejs。从PyPI安装东西而不检查正在安装的东西是很危险的。它可能是一个恶意代码——你不应该只是在pip install后面输入一个名字,并希望它安装你想要的东西。对于您的npm安装也是如此(软件包来自同一作者);在过去的6年里都没有更新过,可能包含一些漏洞,所以我会尽快卸载它们;)

从版本号可以立即看出有些事情是错误的,因为当前的nodejs版本通常是10,(确切的版本取决于你的JupyterLab版本,即10或12;

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

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

ThenRESTART JUPYTER LAB

最新更新