“jupyter notebook"和“jupyter server"有什么区别? [英] What is the difference between `jupyter notebook` and `jupyter server`?

查看:68
本文介绍了“jupyter notebook"和“jupyter server"有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行 jupyter notebookjupyter server 给了我非常相似的结果,描述也非常相似.

Running jupyter notebook and jupyter server give me very similar results and the descriptions are also quite similar.

❯ jupyter notebook -h
The Jupyter HTML Notebook.

This launches a Tornado based HTML Notebook Server that serves up an
HTML5/Javascript Notebook client.

❯ jupyter server -h
The Jupyter Server.

This launches a Tornado-based Jupyter Server.

有一些差异,比如 server 不加载 nbextensions 但我不明白为什么有两个命令有这么多重叠.

There are differences like server doesn't load nbextensions but I don't understand why there are two commands that have so much overlap.

供参考,这是各个模块的版本.

For reference, this are the versions of various modules.

❯ jupyter --version
jupyter core     : 4.7.1
jupyter-notebook : 6.3.0
qtconsole        : 5.0.3
ipython          : 7.22.0
ipykernel        : 5.3.4
jupyter client   : 6.1.12
jupyter lab      : 3.0.11
nbconvert        : 6.0.7
ipywidgets       : 7.6.3
nbformat         : 5.1.3
traitlets        : 5.0.5

推荐答案

Jupyter Notebook(notebook 模块)包含两者:

Jupyter Notebook (notebook module) contains both:

  • 笔记本服务器(托管笔记本内容的 Web 应用程序的后端,代理与内核的交互,并通过例如在启动时打开互联网浏览器与操作系统交互;这部分通常用 Python 编写),以及
  • 客户端(Web 应用程序的前端,例如 HTML 代码、javascript 和服务器上的一些额外 REST API 点).

但是,因为现在有多个客户端(前端)为笔记本提供不同的 Web 应用程序:

However, because there are now multiple clients (frontends) providing different web applications for notebooks:

  • Jupyter 笔记本
  • JupyterLab
  • RetroLab
  • 互动
  • 在 Jupyter 项目之外开发的多个专有客户端

拆分所有这些使用的服务器组件是有意义的,例如JupyterLab 不必依赖于 notebook.这也意味着,如果需要对服务器组件进行修复,它可以在独立于 Jupyter Notebook 发布周期的情况下快速发布(所有前端的用户都可以立即受益).

It made sense to split the server component used by all of these so that e.g. JupyterLab does not have to depend on notebook. This also means that if a fix to the server component is needed, it can be released quickly independent of Jupyter Notebook release cycle (and users of all frontents can benefit immediately).

因此,为了使拆分干净利落,旧的 Jupyter Notebook 被拆分为:

As a consequence, and to make the break up clean, the old Jupyter Notebook was split into:

  • jupyter-server - 由 JuptyterLab、RetroLab、ntreact 改编的服务器
  • nbclassic - 作为 jupyter 服务器扩展的 Jupyter Notebook
  • jupyter-server - the server which was adapted by JuptyterLab, RetroLab, ntreact
  • nbclassic - the Jupyter Notebook as a jupyter-server extension

这意味着对用户和开发者的改变,一些已经在 从笔记本迁移" 文档:

This implies changes for users and developers, some already described in "migrate from notebook" docs:

  • 特定于服务器而不是笔记本的选项从 c.NotebookApp 重命名为 c.ServerApp(特定于笔记本的选项保持 c.NotebookApp代码>)
  • 服务器特定的配置现在存储在 jupyter_server_config.py 而不是 jupyter_notebook_config.py(.json 版本相同)莉>
  • 用户现在应该使用 jupyter server extension 而不是 jupyter serverextension(注意额外的空格!)来列出、启用或禁用扩展
  • 服务器扩展需要将它们的文件放在一个新位置:etc/jupyter/jupyter_server_config.d 而不是 etc/jupyter/jupyter_notebook_config.d(实际上大多数为支持 jupyter 服务器而更新的扩展现在将文件放置在两个位置以与笔记本向后兼容,但这将在未来发生变化)
  • the options specific to server rather than notebook were renamed from c.NotebookApp to c.ServerApp (the options specific to notebook remain c.NotebookApp)
  • the server-specific configuration is now stored in jupyter_server_config.py rather than jupyter_notebook_config.py (same for .json version)
  • users should now use jupyter server extension rather than jupyter serverextension (note the extra space!) to list, enable or disable extensions
  • the server extensions need to place their files in a new location: etc/jupyter/jupyter_server_config.d rather than etc/jupyter/jupyter_notebook_config.d (in practice most extensions that were updated to support jupyter server are now placing files in both locations for backward compatibility with notebook, but this will change in the future)

需要注意的是,根据您启动 jupyter notebook 的方式,您将看到使用的服务器不同:

It is important to note that depending on how you start your jupyter notebook, you will see different servers being used:

  • jupyter nbclassic(假设安装了 nbclassic)将使用新的 jupyter-server
  • jupyter notebook 将使用旧的 notebook 服务器
  • jupyter lab 将使用新的 jupyter-server 从 JupyterLab 3.0 开始,除非在 JupyterHub/Binder 上运行,它可能仍在使用旧的 notebook服务器,取决于配置
  • jupyter nbclassic (assuming nbclassic is installed) will use the new jupyter-server
  • jupyter notebook will use the old notebook server
  • jupyter lab will use new jupyter-server starting with JupyterLab 3.0 unless running on JupyterHub/Binder where it might still be using old notebook server, depending on configuration

这也意味着您在运行 jupyter notebookjupyter nbclassic 时可能会看到不同的扩展(取决于他们的开发人员是否更新了位置,以及他们是否决定要支持旧的 notebook 服务器).

This also implies that you may see different extensions when running jupyter notebook vs jupyter nbclassic (depending on whether their developers updated the locations, and whether they decided they want to support the legacy notebook server).

创建 nbclassic 替换而不是从现有的 notebook 包中删除服务器代码是为了确保向后兼容性,这就是为什么你仍然有两个副本Tornado 服务器(一个由 jupyter notebook 提供,一个由 jupyter server 提供).为了使情况更简单,您可以删除 notebook 并安装 nblcassic,但鉴于过渡正在进行中,您可能需要手动调整一些内容.但是,这只是暂时的情况,因为计划从 v7.0 开始将 Notebook 迁移到使用 jupyter 服务器.

The creation of nbclassic replacement rather than removal of the server code from existing notebook package was meant to ensure backward compatibility, and this is why you still have two copies of the Tornado server (one provided by jupyter notebook and one by jupyter server). To make the situation simpler you could remove notebook and install nblcassic, but given that the transition is in progress you may need to adjust a few things manually. However, this is only a temporary situation, as it is planned that Notebook will be migrated to use jupyter server starting with v7.0.

这现在看起来可能不方便,但此步骤可确保核心 Jupyter 基础架构在未来具有更高的可维护性,并将在以后极大地使用户和系统管理员受益.

This might look inconvenient for now, but this step ensures greater maintainability of the core Jupyter infrastructure in the future and will benefit users and system admins greatly later on.

这篇关于“jupyter notebook"和“jupyter server"有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆