我在安装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
)。我尝试先在本地操作系统(Ubuntu 16.04)上安装这两个软件包并重新安装jupyterlab
,但这没有帮助。在我的操作系统上卸载了软件包之后,我还尝试在虚拟环境中安装nodejs
和npm
通过pip
,以确保它们没有冲突。不幸的是,这两个尝试都没有成功。
奇怪的是,如果我在终端上键入 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
安装在操作系统中。