Jupyter和IPython内核无法在RHEL 7.6上启动

问题描述 投票:1回答:1

我被困了......我正在尝试在新建的企业Linux机器上设置一个Jupyter服务器。我有Miniconda和Anaconda路线,Python 3.7和3.6。我尝试使用pip和conda分别安装和重新安装Jupyter / IPython。

不可避免的是,基于浏览器的Jupyter笔记本无法执行任何代码,它被卡在In [*]状态。这表明内核出现故障。

确实,

$ jupyter console --debug
[ZMQTerminalIPythonApp] Searching ['/home/scadmin', '/home/scadmin/.jupyter', '/opt/conda/a3/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
[ZMQTerminalIPythonApp] Looking for jupyter_config in /etc/jupyter
[ZMQTerminalIPythonApp] Looking for jupyter_config in /usr/local/etc/jupyter
[ZMQTerminalIPythonApp] Looking for jupyter_config in /opt/conda/a3/etc/jupyter
[ZMQTerminalIPythonApp] Looking for jupyter_config in /home/scadmin/.jupyter
[ZMQTerminalIPythonApp] Looking for jupyter_config in /home/scadmin
[ZMQTerminalIPythonApp] Looking for jupyter_console_config in /etc/jupyter
[ZMQTerminalIPythonApp] Looking for jupyter_console_config in /usr/local/etc/jupyter
[ZMQTerminalIPythonApp] Looking for jupyter_console_config in /opt/conda/a3/etc/jupyter
[ZMQTerminalIPythonApp] Looking for jupyter_console_config in /home/scadmin/.jupyter
[ZMQTerminalIPythonApp] Loaded config file: /home/scadmin/.jupyter/jupyter_console_config.py
[ZMQTerminalIPythonApp] Looking for jupyter_console_config in /home/scadmin
[ZMQTerminalIPythonApp] Connection File not found: /run/user/1008/jupyter/kernel-19936.json
[ZMQTerminalIPythonApp] Starting kernel: ['/opt/conda/a3/bin/python', '-m', 'ipykernel_launcher', '-f', '/run/user/1008/jupyter/kernel-19936.json']
[ZMQTerminalIPythonApp] Connecting to: tcp://127.0.0.1:47202
[ZMQTerminalIPythonApp] connecting shell channel to tcp://127.0.0.1:47589
[ZMQTerminalIPythonApp] Connecting to: tcp://127.0.0.1:47589
[ZMQTerminalIPythonApp] connecting iopub channel to tcp://127.0.0.1:42874
[ZMQTerminalIPythonApp] Connecting to: tcp://127.0.0.1:42874
[ZMQTerminalIPythonApp] connecting stdin channel to tcp://127.0.0.1:32777
[ZMQTerminalIPythonApp] Connecting to: tcp://127.0.0.1:32777
[ZMQTerminalIPythonApp] connecting heartbeat channel to tcp://127.0.0.1:44354
Traceback (most recent call last):
  File "/opt/conda/a3/lib/python3.7/site-packages/jupyter_console/ptshell.py", line 341, in init_kernel_info
    reply = self.client.get_shell_msg(timeout=1)
  File "/opt/conda/a3/lib/python3.7/site-packages/jupyter_client/client.py", line 77, in get_shell_msg
    return self.shell_channel.get_msg(*args, **kwargs)
  File "/opt/conda/a3/lib/python3.7/site-packages/jupyter_client/blocking/channels.py", line 57, in get_msg
    raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/a3/bin/jupyter-console", line 11, in <module>
    sys.exit(main())
  File "/opt/conda/a3/lib/python3.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/opt/conda/a3/lib/python3.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-116>", line 2, in initialize
  File "/opt/conda/a3/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/opt/conda/a3/lib/python3.7/site-packages/jupyter_console/app.py", line 142, in initialize
    self.init_shell()
  File "/opt/conda/a3/lib/python3.7/site-packages/jupyter_console/app.py", line 115, in init_shell
    confirm_exit=self.confirm_exit,
  File "/opt/conda/a3/lib/python3.7/site-packages/traitlets/config/configurable.py", line 412, in instance
    inst = cls(*args, **kwargs)
  File "/opt/conda/a3/lib/python3.7/site-packages/jupyter_console/ptshell.py", line 287, in __init__
    self.init_kernel_info()
  File "/opt/conda/a3/lib/python3.7/site-packages/jupyter_console/ptshell.py", line 344, in init_kernel_info
    raise RuntimeError("Kernel didn't respond to kernel_info_request")
RuntimeError: Kernel didn't respond to kernel_info_request
$ [IPKernelApp] WARNING | Parent appears to have exited, shutting down.

任何帮助和想法将不胜感激......

jupyter-notebook ipython conda rhel7
1个回答
1
投票

默认情况下,除了指定的端口之外,归结为防火墙策略丢弃TCP流量。

将此添加到/etc/sysconfig/iptables后跟systemctl restart iptables解决了这个问题。

-A INPUT -p tcp -m tcp -s localhost --dport 32768:65535 -m state --state NEW -m comment --comment "Jupyter ZeroMQ" -j ACCEPT

请注意Jupyter documentation asks for port range 49152:65535 for the ZeroMQ communication。事实上,它选择的端口范围更广,因此从32768开始。

© www.soinside.com 2019 - 2024. All rights reserved.