python - 无法在 docker 映像中安装任何 jupyterlab 扩展
问题描述
我在本地主机上运行的管道代理上的 Azure 管道中运行 docker build 任务。我正在尝试“运行 jupyter labextension install @jupyter-widgets/jupyterlab-manager”。
在基础图像中:
node=14.14.0
jupyter=1.0.0
jupyter-packaging = 0.7.12
jupyter-resource-usage= 0.5.1
jupyter_client = 6.1.7
jupyter_console = 6.2.0
jupyter_core = 4.7.0
jupyter_server = 1.6.1
jupyter_telemetry = 0.1.0
jupyterhub = 1.3.0
jupyterhub-base = 1.3.0
jupyterlab = 3.0.12
jupyterlab-git = 0.30.0b2
jupyterlab-templates = 0.2.5
jupyterlab_code_formatter=1.4.5
jupyterlab_pygments = 0.1.2
jupyterlab_server = 2.3.0
Dockerfile 看起来像这样:
USER root
COPY files/.npmrc $HOME/.npmrc
RUN jupyter labextension install --no-build @jupyter-widgets/jupyterlab-manager .....
.npmrc 看起来像这样:
always-auth=true
strict-ssl=false
registry=https://pkgs.dev.azure.com/org-name/proj-name/_packaging/proj-name/npm/registry/
https-proxy=the-proxy-url
proxy=the-proxy-url
管道执行以下任务:
- 在 .npmrc 上运行 npmAuthenticate 任务以使用 auth-token 编辑 .npmrc 文件。这个成功了。。
- 接下来运行 docker build。Dockerfile 指示将此修改后的 .npmrc 复制到 $HOME 并尝试安装实验室扩展
找到这个线程:https ://github.com/jupyter-widgets/ipywidgets/issues/1982#issuecomment-468716770 我们使用jupyterlab v3。所以 node>=12 是必需的。所以我将 Dockerfile 更改为:
USER root
COPY files/.npmrc $HOME/.npmrc
RUN conda remove nodejs && conda install -c conda-forge nodejs=12 && conda list | grep nodejs &&\
jupyter labextension install --no-build @jupyter-widgets/jupyterlab-manager .....
也试过这个:https ://stackoverflow.com/a/52484330/3575135 。没有帮助
正常的“npm install @angular/cli”可以工作。但是实验室的扩展让我很难过。在这一点上似乎没有任何工作..
这是错误:
ValueError: "@jupyter-widgets/jupyterlab-manager" is not a valid npm package
请帮忙!
解决方案
您不应该为 JupyterLab 3.0+ 安装 Node.js 或 @jupyter-widgets/jupyterlab-manager。扩展系统得到了改进,新的“联合扩展”系统不再需要 Node.js(并且大多数扩展已经从 Node.js 的要求中迁移出来)。@jupyter-widgets/jupyterlab-manager的自述文件明确指出,对于 JupyterLab 3.0+,您应该使用:
pip install jupyterlab_widgets
大多数扩展也是如此 - 如果它们迁移,它们将在其自述文件中包含 PyPI 包的名称。有关更深入的解释,请阅读此答案。
作为一个好的建议,请仅jupyter labextension install
用于尚未迁移到 pip/conda-installable 联合扩展的扩展。
推荐阅读
- google-bigquery - 无法将 BigQuery 连接到 us-east1 中的 CloudSQL Postgres 实例
- snmp - 发送 SNMP 陷阱时,OID 是否应该与 MIB 树的顺序相同?
- ios - 什么是“app_store_keychain-db”以及为什么我的密码不起作用
- c# - 如何解决构建问题 NETSDK1056
- r - 如何将 R Bar Plot 格式化为带有轴标签的中心条
- c++ - rpcndr 和 cstddef 中的模糊字节定义
- oracle - Oracle触发器根据另一个表中的值限制空值
- javascript - undefined 不是函数(评估 't.matches(e)')
- android - 已创建数据库但未在 SQLite 中创建表
- android - 当 BehaviorSubject 的 subscribe 完成 Activity 时,应用程序崩溃了