`jupyterlab` 无法识别 `nodejs` 和 `npm` 安装
`jupyterlab` doesn't recognize `nodejs` and `npm` installations
我在安装 jupyterlab_bokeh
扩展时遇到问题。
$ jupyter labextension install jupyterlab_bokeh
Errored, use --debug for full output:
ValueError: Please install nodejs and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website.
我正在使用虚拟环境(pyenv
加上 pyenv-virtualenvwrapper
)。我尝试先在我的本地 OS (Ubuntu 16.04) 上安装这两个软件包,然后重新安装 jupyterlab
但这没有帮助。我还尝试在虚拟环境中通过 pip
安装 nodejs
和 npm
,在我的 OS 上卸载软件包后,只是为了确保它们没有冲突.可惜,试探性的都没有成功。
奇怪的是,如果我在终端上输入 nodejs 命令,我可以访问 nodejs
REPL。
bokeh==0.12.13
jupyter-client==5.2.1
jupyter-core==4.4.0
jupyterlab==0.31.1
jupyterlab-launcher==0.10.2
问题不限于扩展 jupyterlab_bokeh
。我可以使用扩展名 jupyterlab-manager
.
复制相同的错误
我实际上注意到,如果我 运行 jupyter labextension list
我可以看到两个扩展都已正确安装:
$ jupyter labextension list
JupyterLab v0.31.1
Known labextensions:
app dir: /home/gianluca/.virtualenvs/rethinking/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager
@jupyter-widgets/jupyterlab-manager v0.33.0 enabled OK
jupyterlab_bokeh
jupyterlab_bokeh v0.2.0 enabled OK
Build recommended, please run `jupyter lab build`:
@jupyter-widgets/jupyterlab-manager needs to be included in build
jupyterlab_bokeh needs to be included in build
但是,正如您在上面的片段中看到的,建议使用内置的。如果我尝试 运行 构建,这是我看到的错误消息:
$ jupyter lab build
[LabBuildApp] > node /home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/staging/yarn.js install
Traceback (most recent call last):
File "/home/gianluca/.virtualenvs/rethinking/bin/jupyter-lab", line 11, in <module>
sys.exit(main())
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/notebook/notebookapp.py", line 1431, in start
super(NotebookApp, self).start()
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyter_core/application.py", line 255, in start
self.subapp.start()
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/labapp.py", line 64, in start
command=command, logger=self.log)
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/commands.py", line 238, in build
command=command, clean_staging=clean_staging)
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/commands.py", line 376, in build
self._run(['node', YARN_PATH, 'install'], cwd=staging)
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/commands.py", line 1158, in _run
proc = Process(cmd, **kwargs)
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/process.py", line 72, in __init__
self.proc = self._create_process(cwd=cwd, env=env)
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/process.py", line 130, in _create_process
cmd[0] = which(cmd[0], kwargs.get('env'))
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/jlpmapp.py", line 59, in which
raise ValueError(msg)
ValueError: Please install nodejs and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website.
同样,nodejs
和 npm
都安装在操作系统中。
尝试使用
安装 nodejs legacy
sudo apt install nodejs-legacy
或者您可以
sudo ln -s /usr/bin/nodejs /usr/bin/node
问题是 jupyter 期望 nodejs
使用命令 node
可用,但现在不是这样了
问题与安装的 nodejs
版本有关。 Ubuntu 16.04 LTS 附带 v4.2.6。我已经解决了安装 nodejs
v6 的问题。如果需要在Ubuntu 16.04 LTS安装,可以按照this excellent tutorial.
确保从 jupyter 的终端而不是从笔记本中安装 nodejs。
相关:
我在安装 jupyterlab_bokeh
扩展时遇到问题。
$ jupyter labextension install jupyterlab_bokeh
Errored, use --debug for full output:
ValueError: Please install nodejs and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website.
我正在使用虚拟环境(pyenv
加上 pyenv-virtualenvwrapper
)。我尝试先在我的本地 OS (Ubuntu 16.04) 上安装这两个软件包,然后重新安装 jupyterlab
但这没有帮助。我还尝试在虚拟环境中通过 pip
安装 nodejs
和 npm
,在我的 OS 上卸载软件包后,只是为了确保它们没有冲突.可惜,试探性的都没有成功。
奇怪的是,如果我在终端上输入 nodejs 命令,我可以访问 nodejs
REPL。
bokeh==0.12.13
jupyter-client==5.2.1
jupyter-core==4.4.0
jupyterlab==0.31.1
jupyterlab-launcher==0.10.2
问题不限于扩展 jupyterlab_bokeh
。我可以使用扩展名 jupyterlab-manager
.
我实际上注意到,如果我 运行 jupyter labextension list
我可以看到两个扩展都已正确安装:
$ jupyter labextension list
JupyterLab v0.31.1
Known labextensions:
app dir: /home/gianluca/.virtualenvs/rethinking/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager
@jupyter-widgets/jupyterlab-manager v0.33.0 enabled OK
jupyterlab_bokeh
jupyterlab_bokeh v0.2.0 enabled OK
Build recommended, please run `jupyter lab build`:
@jupyter-widgets/jupyterlab-manager needs to be included in build
jupyterlab_bokeh needs to be included in build
但是,正如您在上面的片段中看到的,建议使用内置的。如果我尝试 运行 构建,这是我看到的错误消息:
$ jupyter lab build
[LabBuildApp] > node /home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/staging/yarn.js install
Traceback (most recent call last):
File "/home/gianluca/.virtualenvs/rethinking/bin/jupyter-lab", line 11, in <module>
sys.exit(main())
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/notebook/notebookapp.py", line 1431, in start
super(NotebookApp, self).start()
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyter_core/application.py", line 255, in start
self.subapp.start()
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/labapp.py", line 64, in start
command=command, logger=self.log)
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/commands.py", line 238, in build
command=command, clean_staging=clean_staging)
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/commands.py", line 376, in build
self._run(['node', YARN_PATH, 'install'], cwd=staging)
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/commands.py", line 1158, in _run
proc = Process(cmd, **kwargs)
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/process.py", line 72, in __init__
self.proc = self._create_process(cwd=cwd, env=env)
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/process.py", line 130, in _create_process
cmd[0] = which(cmd[0], kwargs.get('env'))
File "/home/gianluca/.virtualenvs/rethinking/lib/python3.6/site-packages/jupyterlab/jlpmapp.py", line 59, in which
raise ValueError(msg)
ValueError: Please install nodejs and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website.
同样,nodejs
和 npm
都安装在操作系统中。
尝试使用
安装 nodejs legacysudo apt install nodejs-legacy
或者您可以
sudo ln -s /usr/bin/nodejs /usr/bin/node
问题是 jupyter 期望 nodejs
使用命令 node
可用,但现在不是这样了
问题与安装的 nodejs
版本有关。 Ubuntu 16.04 LTS 附带 v4.2.6。我已经解决了安装 nodejs
v6 的问题。如果需要在Ubuntu 16.04 LTS安装,可以按照this excellent tutorial.
确保从 jupyter 的终端而不是从笔记本中安装 nodejs。
相关: