Windows11下Jupyter Notebook中Bash内核连接失败求助
Jupyter Notebook中Bash内核连接失败问题求助
在Jupyter Notebook使用Bash内核时,反复出现以下错误:
Connection failed
无法建立与Notebook服务器的连接。Notebook将继续尝试重新连接。请检查您的网络连接或Notebook服务器配置。
已执行的安装与排查步骤
我在Windows 11系统下,按以下流程安装Bash内核:
conda create --name bash_env --clone arcgispro-py3 conda install -c conda-forge bash_kernel python -m bash_kernel.install
但无论后续如何调整配置,始终触发上述连接失败错误。
系统与配置信息
- 执行
jupyter kernelspec list返回结果:
.net-csharp C:\Users\myusername\AppData\Roaming\jupyter\kernels\.net-csharp .net-fsharp C:\Users\myusername\AppData\Roaming\jupyter\kernels\.net-fsharp .net-powershell C:\Users\myusername\AppData\Roaming\jupyter\kernels\.net-powershell bash C:\Users\myusername\AppData\Roaming\jupyter\kernels\bash javascript C:\Users\myusername\AppData\Roaming\jupyter\kernels\javascript python3 C:\Users\myusername\AppData\Local\ESRI\conda\envs\bash_env\share\jupyter\kernels\python3
- bash内核目录下的
kernel.json内容:
{"argv": ["C:\\Users\\myusername\\AppData\\Local\\ESRI\\conda\\envs\\bash_env\\python.exe", "-m", "bash_kernel", "-f", "{connection_file}"], "codemirror_mode": "shell", "display_name": "Bash", "env": {"PS1": "$"}, "language": "bash"}
注:已尝试修改kernel.json的多种配置(包括直接指向bash.exe路径),也删除过整个bash内核目录让其从bash_env环境读取配置,问题仍未解决。
- 已安装Git Bash,执行
where bash返回:
C:\Program Files\Git\usr\bin\bash.exe C:\Windows\System32\bash.exe
- bash_env环境中的核心包版本:
- jupyter_server 1.21.0
- ipykernel 6.16.0
- ipython 7.34.0
额外排查操作
- 已删除浏览器Cookies,无效。
- 日志中捕获到关键错误回溯:
AttributeError: module 'pexpect' has no attribute 'spawn' [I 14:19:58.810 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports 0.00s - Debugger warning: It seems that frozen modules are being used, which may 0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off 0.00s - to python to disable frozen modules. 0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation. Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code
内容的提问来源于stack exchange,提问作者ENIAC-6
相关产品推荐
相关产品推荐

