You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 18.04 LTS下Jupyter Notebook无理由崩溃求助

解决Jupyter Notebook内核启动报错:signal only works in main thread

问题分析

从你提供的错误日志来看,核心问题有两个:

  1. ValueError: signal only works in main thread:新版本ipykernel与Python3.6不兼容,导致在非主线程中调用signal模块触发错误
  2. RuntimeError: This event loop is already running:tornado、pyzmq版本与Python3.6的异步事件循环机制冲突
    另外日志中出现的Jupytext扩展也可能干扰了内核的正常启动流程。

解决步骤

1. 彻底清理旧Jupyter环境

之前的重装可能残留了配置或旧包,先彻底清除:

pip3 uninstall -y jupyter jupyter_core jupyter-client jupyter-console jupyterlab ipykernel ipython nbconvert notebook qtconsole
rm -rf ~/.jupyter ~/.local/share/jupyter ~/.cache/jupyter

2. 安装Python3.6兼容的指定版本包

Python3.6已停止维护,新版本Jupyter组件不再适配,直接安装经过验证的兼容版本:

pip3 install ipykernel==5.5.6 jupyter-client==6.1.12 notebook==6.4.12 tornado==6.0.4 pyzmq==22.3.0

3. 禁用Jupytext扩展

Jupytext对内容管理器的修改可能引发线程冲突,先禁用:

jupyter serverextension disable --py jupytext
jupyter nbextension disable --py jupytext

4. 测试启动

重新启动Jupyter Notebook:

jupyter notebook

打开任意笔记本,观察终端是否还出现之前的错误。

内容的提问来源于stack exchange,提问作者user2165656

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 01:48:28