2021-03-17
因为jupyter notebook的代码补全不好使, 打算装一个kite
在jupyter lab安装好了kite后, 需要编译(build)
jupyter lab build
报错RuntimeError: npm dependencies failed to install
[LabBuildApp] JupyterLab 3.0.10
[LabBuildApp] Building in /home/loli/.local/share/jupyter/lab
[LabBuildApp] Building jupyterlab assets (production, minimized)
Build failed.
Troubleshooting: If the build failed due to an out-of-memory error, you
may be able to fix it by disabling thedev_build
and/orminimize
options.If you are building via the
jupyter lab build
command, you can disable
these options like so:jupyter lab build –dev-build=False –minimize=False
You can also disable these options for all JupyterLab builds by adding these
lines to a Jupyter config file namedjupyter_config.py
:c.LabBuildApp.minimize = False
c.LabBuildApp.dev_build = FalseIf you don’t already have a
jupyter_config.py
file, you can create one by
adding a blank file of that name to any of the Jupyter config directories.
The config directories can be listed by running:jupyter –paths
Explanation:
dev-build
: This option controls whether adev
or a more streamlined
production
build is used. This option will default toFalse
(i.e., the
production
build) for most users. However, if you have any labextensions
installed from local files, this option will instead default toTrue
.
Explicitly settingdev-build
toFalse
will ensure that theproduction
build is used in all circumstances.
minimize
: This option controls whether your JS bundle is minified
during the Webpack build, which helps to improve JupyterLab’s overall
performance. However, the minifier plugin used by Webpack is very memory
intensive, so turning it off may help the build finish successfully in
low-memory environments.An error occured.
RuntimeError: npm dependencies failed to install
See the log file for details: /tmp/jupyterlab-debug-fz1wbvsf.log
环境/版本
- 操作系统: ubuntu 18.04 LTS
- python-3.6.9
- jupyter-1.0.0
- jupyterlab-3.0.10
- jupyterlab-kite-2.0.2
- node-v14.16.0
- npm-7.6.3
- yarn-1.22.10
报错日志
1 | [LabBuildApp] Building in /home/loli/.local/share/jupyter/lab |
可以看到这样一段
1 | "https://registry.npm.taobao.org/@jupyterlab/application/-/application-3.0.6.tgz: Request failed \"404 Not Found\"". |
用浏览器打开也发现:
无法访问, 看来是taobao源出现了问题, 现在需要换源
解决
npm/yarn的源网上有很多, 这里以最不好找的官方源为例(没错, 官方默认的源反而最难找)
1 | sudo yarn config set registry https://registry.yarnpkg.com --global |
查看yarn
版本信息:
1 | yarn config list |
显示:
1 | yarn config v1.22.10 |
找到安装yarn
的地方
1 | whereis yarn |
删掉node_modules
和yarn.lock
, 重新下载
1 | sudo rm yarn.lock |
同样, 再找到jupyter lab在哪儿
1 | whereis jupyter |
重复上面工作, 删除后再下载:
1 | rm yarn.lock |
出现了一堆warning, 不用管
然后build:
1 | jupyter lab build |
没报错, 成功解决