如何在 AWS EC2 上为 Jupyter Lab 安装 Tensorboard 扩展?

How to install Tensorboard extension to Jupyter Lab on AWS EC2?

我想将 Temsorboard 安装到 AWS EC2 上的 Jupyter 实验室,但它不起作用。 我有类似的问题 .

出于安全考虑,我不想像某些人建议的那样打开防火墙的问题。所以这个答案并没有解决我的情况。而且我不明白为什么它不能执行任何这些操作,因为我可以使用 anaconda 下载、安装、删除、更新任何软件包,总体而言,防火墙似乎没有对其他任何地方产生负面影响。

环境

我经常遇到这个问题,即没有安装任何扩展并且无法从扩展中运行。例如:在 GUI 中我搜索了 tensorboard click to install than

Build Recommended
JupyterLab build is suggested:
jupyterlab_tensorboard needs to be included in build

点击了 BUILD

输出Build failed with 500, please run 'jupyter lab build' on the server for full output

输入:jupyter lab build

输出:

[LabBuildApp] JupyterLab 1.2.6
[LabBuildApp] Building in /home/ubuntu/anaconda3/share/jupyter/lab
[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
An error occured.
RuntimeError: npm dependencies failed to install
See the log file for details:  /tmp/jupyterlab-debug-lctnnmuf.log

错误消息日志:

nano /tmp/jupyterlab-debug-f61pajsv.log

输出:

[LabBuildApp] Building in /home/ubuntu/anaconda3/share/jupyter/lab
[LabBuildApp] Yarn configuration loaded.
[LabBuildApp] Node v6.13.1

[LabBuildApp] Building jupyterlab assets (build:prod:minimize)
[LabBuildApp] > node /home/ubuntu/anaconda3/lib/python3.7/site-packages/jupyterlab/staging/yarn.js install --non-int$
[LabBuildApp] yarn install v1.15.2
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
error ws@7.2.1: The engine "node" is incompatible with this module. Expected version ">=8.3.0". Got "6.13.1"
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

[LabBuildApp] npm dependencies failed to install
[LabBuildApp] Traceback (most recent call last):

[LabBuildApp]   File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/jupyterlab/debuglog.py", line 47, in debug_$
    yield

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

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

[LabBuildApp]   File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/jupyterlab/commands.py", line 660, in build
    raise RuntimeError(msg)

[LabBuildApp] RuntimeError: npm dependencies failed to install

[LabBuildApp] Exiting application: JupyterLab

输入:sudo jupyter lab build

输出:

Traceback (most recent call last):
  File "/usr/local/bin/jupyter", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/jupyter_core/command.py", line 285, in main
    command = _jupyter_abspath(subcommand)
  File "/usr/local/lib/python3.6/dist-packages/jupyter_core/command.py", line 125, in _jupyter_abspath
    'Jupyter command `{}` not found.'.format(jupyter_subcommand)
Exception: Jupyter command `jupyter-lab` not found.

回答 https://github.com/jupyterlab/jupyterlab/issues/10358#issuecomment-860080291

鉴于此消息:

error ws@7.2.1: The engine "node" is incompatible with this module. Expected version ">=8.3.0". Got "6.13.1"

还有这个:

[LabBuildApp] Node v6.13.1

看来您使用的是 node.js 的过时版本。如果您担心安全问题,您应该升级到受支持的 Node.js 版本。 Node 的当前 LTS 版本是 14.17.0(所以你落后了四个 LTS 版本——我会害怕使用这样的设置),最新版本是 16.3。我建议升级到 Node 12(不太理想)或 Node 14(最佳)。

升级 Node.js 时,您很可能还需要更新 JupyterLab,无论如何我都会推荐您 运行:

[LabBuildApp] JupyterLab 1.2.6

而JupyterLab的当前版本是3.0.16(3.1即将发布);我强烈建议至少升级到最新的 2.x 版本(或直接升级到 3.x 系列);自 1.2.6 版本以来有许多安全修复程序。

另请注意,从 JupyterLab 3.0 开始,无需 Node.js 即可安装许多扩展。我现在知道张量板扩展是否属于这种情况 - 最好与作者联系。