无法安装 jupyterlab-execute-time 扩展

Unable to install jupyterlab-execute-time extension

每当我尝试安装 jupyterlab-execute-time 扩展时,我都会收到以下错误。有什么解决办法吗?我正在使用 Jupyter Lab 版本 3.0.14。

Extension Installation Error

Extension Installation Error
An error occurred installing <code>jupyterlab-execute-time</code>.

Error message:

The extension "jupyterlab-execute-time" does not yet support the current version of JupyterLab.


Conflicting Dependencies:
JupyterLab                  Extension      Package
>=3.0.9 <3.1.0              >=2.0.2 <3.0.0 @jupyterlab/application
>=3.0.9 <3.1.0              >=2.0.2 <3.0.0 @jupyterlab/notebook
>=3.0.5 <3.1.0              >=2.0.1 <3.0.0 @jupyterlab/settingregistry

TLDR:

pip install jupyterlab_execute_time  # or, if using conda:
# conda install -c conda-forge jupyterlab_execute_time

解释:

您似乎在尝试使用旧的方式安装扩展(jupyter labextension install @org/extension-name,这也是 Extension Manager 安装扩展的方式),它使用 NPM 服务器下载代码并要求用户拥有Node.js 安装(编译代码)。

但是,由于 JupyterLab 3.0 扩展可能不再需要安装 Node.js;他们使用新的 prebuilt extensions 机制(也称为联合扩展),这意味着他们不再需要编译。使用 NPM 进行分发的要求也不再适用。相反,作者现在通常通过 PyPI 或 conda-forge 等其他渠道分发扩展(因为如果有人安装了 JupyterLab,他们很可能使用这两个分发渠道之一)。

针对 JupyterLab 3.0+ 的扩展作者可以选择:

  1. 继续在 NPM 上发布并忽略新的联合扩展机制,或者
  2. 调整联合扩展并开始仅发布到 PyPI/conda-forge,或者
  3. 同时发布到 NPM 和 PyPI/conda-forge

jupyterlab-execute-time 的情况下,作者采用了 (2) 路线,仅发布到 PyPI/conda-forge,写作日期的最新发布版本是 2.0.2 on PyPI; the NPM package however was not removed and it remained on the old version 1.1.0 on NPM(对于仍然需要使用旧的 JupterLab 2.x 行的用户来说是很好的)。你可能希望在 GitHub 上联系作者并要求他们在 NPM 上发布一个新版本,他们可能会拒绝,因为它会带来额外的维护成本并且没有那么多好处(好处主要是给使用的用户内置扩展管理器,因为它仍未更新以与 PyPI/conda-forge 安装一起使用,但这是路线图上的一个功能 - 如果可以,请做出贡献。

要轻松检查其他扩展的情况,请仔细阅读 GitHub、PyPI 和 NPM 页面上的安装说明(如果有的话);在 jupyterlab_execute_time 的情况下,您可以清楚地看到 NPM 版本 为 JupyterLab 3.0 更新(请参阅蓝色突出显示):

而 PyPI(和 GitHub)上的版本是(见黄色突出显示):