你如何使用自定义端口启动 Jupyter 内核?

huangapple go评论54阅读模式
英文:

How do you start a jupyter kernel with custom ports?

问题

我正在尝试像这样启动一个Jupyter内核:

jupyter-kernel \
       --ip=0.0.0.0 \
       --KernelManager.control_port=56406 \
       --KernelManager.hb_port=56407 \
       --KernelManager.iopub_port=56408 \
       --KernelManager.shell_port=56409 \
       --KernelManager.stdin_port=56410

它启动了,并且我看到以下输出:

[KernelApp] Starting kernel 'python3'
[KernelApp] Connection file: /Users/jkitchin/Library/Jupyter/runtime/kernel-892382b5-8115-44ba-95cd-d8172ba848ac.json

然而,内核JSON文件包含了以下内容:

cat /Users/jkitchin/Library/Jupyter/runtime/kernel-892382b5-8115-44ba-95cd-d8172ba848ac.json
{
  "shell_port": 55505,
  "iopub_port": 55506,
  "stdin_port": 55507,
  "control_port": 55509,
  "hb_port": 55508,
  "ip": "0.0.0.0",
  "key": "0a163fda-2b4963c994abc4277bdf58fa",
  "transport": "tcp",
  "signature_scheme": "hmac-sha256",
  "kernel_name": ""
}

这些端口与我指定的端口不匹配。我是否漏掉了什么以使其生效?

英文:

I am trying to start a jupyter kernel like this:

jupyter-kernel \
       --ip=0.0.0.0 \
       --KernelManager.control_port=56406 \
       --KernelManager.hb_port=56407 \
       --KernelManager.iopub_port=56408 \
       --KernelManager.shell_port=56409 \
       --KernelManager.stdin_port=56410

It starts, and I see this output:

[KernelApp] Starting kernel 'python3'
[KernelApp] Connection file: /Users/jkitchin/Library/Jupyter/runtime/kernel-892382b5-8115-44ba-95cd-d8172ba848ac.json

however, the kernel json contains:

cat /Users/jkitchin/Library/Jupyter/runtime/kernel-892382b5-8115-44ba-95cd-d8172ba848ac.json
{
  "shell_port": 55505,
  "iopub_port": 55506,
  "stdin_port": 55507,
  "control_port": 55509,
  "hb_port": 55508,
  "ip": "0.0.0.0",
  "key": "0a163fda-2b4963c994abc4277bdf58fa",
  "transport": "tcp",
  "signature_scheme": "hmac-sha256",
  "kernel_name": ""
}

which do not match the ports I specified. Am I missing something to make this happen?

答案1

得分: 1

这是翻译好的部分:

Answering my own question here. It turns out the ports were not configurable at the command line even though the documentation suggested they were. This was fixed in https://github.com/jupyter/jupyter_client/pull/956, and now it should work.

英文:

Answering my own question here. It turns out the ports were not configurable at the command line even though the documentation suggested they were. This was fixed in https://github.com/jupyter/jupyter_client/pull/956, and now it should work.

huangapple
  • 本文由 发表于 2023年7月5日 00:13:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/76614380.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定