无法在 GCP AI Platform Notebooks 上安装 Jupyterlab 扩展

时间:2021-01-29 07:52:21

标签: python jupyter-lab gcp-ai-platform-notebook

我在为 Jupyterlab 安装扩展时开始遇到我过去没有遇到过的问题。为 Jupyterlab 安装新扩展后,我无法构建。

我正在使用 GCP AI Platform Notebooks 运行 Jupyterlab。我在 Debian 10 上使用标准 Python 3 环境。我尝试在不同类型的机器上运行。

我收到状态 500 错误。这是我运行 jupyter lab build 时的日志:

[LabBuildApp] WARNING | Config option `kernel_spec_manager_class` not recognized by `LabBuildApp`.
[LabBuildApp] JupyterLab 1.2.16
[LabBuildApp] Building in /opt/conda/share/jupyter/lab
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
An error occured.
PermissionError: [Errno 1] Operation not permitted: '/opt/conda/share/jupyter/lab/staging/index.js'
See the log file for details:  /tmp/jupyterlab-debug-pnbu3naq.log

这是包含详细信息的日志文件:

[LabBuildApp] Building in /opt/conda/share/jupyter/lab
[LabBuildApp] Yarn configuration loaded.
[LabBuildApp] Node v15.3.0

[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
[LabBuildApp] Traceback (most recent call last):

[LabBuildApp]   File "/opt/conda/lib/python3.7/site-packages/jupyterlab/debuglog.py", line 47, in debug_logging
    yield

[LabBuildApp]   File "/opt/conda/lib/python3.7/site-packages/jupyterlab/labapp.py", line 98, in start
    command=command, app_options=app_options)

[LabBuildApp]   File "/opt/conda/lib/python3.7/site-packages/jupyterlab/commands.py", line 459, in build
    command=command, clean_staging=clean_staging)

[LabBuildApp]   File "/opt/conda/lib/python3.7/site-packages/jupyterlab/commands.py", line 650, in build
    clean=clean_staging

[LabBuildApp]   File "/opt/conda/lib/python3.7/site-packages/jupyterlab/commands.py", line 1103, in _populate_staging
    shutil.copy(pjoin(HERE, 'staging', fname), target)

[LabBuildApp]   File "/opt/conda/lib/python3.7/shutil.py", line 249, in copy
    copymode(src, dst, follow_symlinks=follow_symlinks)

[LabBuildApp]   File "/opt/conda/lib/python3.7/shutil.py", line 144, in copymode
    chmod_func(dst, stat.S_IMODE(st.st_mode))

[LabBuildApp] PermissionError: [Errno 1] Operation not permitted: '/opt/conda/share/jupyter/lab/staging/index.js'

[LabBuildApp] Exiting application: JupyterLab

由于我过去能够在其他 VM 实例上为 Jupyterlab 安装相同的扩展,因此我希望它与安装的 Jupyterlab 版本有关。但是,我希望 Google 安装最新版本的 Jupyterlab。

错误日志似乎表明这是一个权限错误,我不明白,因为我在基础上运行 jupyter lab build。创建实例后我更改的唯一设置是启用扩展。

1 个答案:

答案 0 :(得分:1)

您需要以 root 身份编译 jupyter-lab。它不太直观,因为 jupyter 不包含在 root 用户的 $PATH 中。

这是要做的:

sudo apt-get install nodejs  # needed to compile jupyter-lab
sudo /opt/conda/bin/jupyter lab build
相关问题