Windows10下Jupyter创建新笔记本遇Bad file descriptor错误求助
Jupyter Notebook内核忙碌并弹出"Bad file descriptor"错误的解决办法
问题场景
在Windows10 64位系统中,通过CMD启动本地Jupyter Notebook,获取访问URL后尝试创建新笔记本时,内核长时间处于忙碌状态且无法停止,随后CMD中弹出Bad file descriptor错误,具体运行日志如下:
C:\Users\Стася>jupyter notebook [I 2023-02-22 09:43:28.135 LabApp] JupyterLab extension loaded from C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab [I 2023-02-22 09:43:28.135 LabApp] JupyterLab application directory is C:\ProgramData\Anaconda3\share\jupyter\lab [I 09:43:28.155 NotebookApp] The port 8888 is already in use, trying another port. [I 09:43:28.159 NotebookApp] Serving notebooks from local directory: C:\Users\Стася [I 09:43:28.159 NotebookApp] Jupyter Notebook 6.4.12 is running at: [I 09:43:28.160 NotebookApp] http://localhost:8889/?token=16157ff4e8748f17468e22cb013a9b79f39f8404de936eff [I 09:43:28.160 NotebookApp] or http://127.0.0.1:8889/?token=16157ff4e8748f17468e22cb013a9b79f39f8404de936eff [I 09:43:28.160 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 09:43:28.292 NotebookApp] To access the notebook, open this file in a browser: file:///C:/Users/%D0%A1%D1%82%D0%B0%D1%81%D1%8F/AppData/Roaming/jupyter/runtime/nbserver-5456-open.html Or copy and paste one of these URLs: http://localhost:8889/?token=16157ff4e8748f17468e22cb013a9b79f39f8404de936eff or http://127.0.0.1:8889/?token=16157ff4e8748f17468e22cb013a9b79f39f8404de936eff [I 09:43:50.904 NotebookApp] 302 GET /?token=16157ff4e8748f17468e22cb013a9b79f39f8404de936eff (::1) 1.760000ms [I 09:44:10.038 NotebookApp] Creating new notebook in Bad file descriptor (C:\ci\zeromq_1616055400030\work\src\epoll.cpp:100) Bad file descriptor (C:\ci\zeromq_1616055400030\work\src\epoll.cpp:100)
可行解决办法
重置Jupyter配置文件
- 关闭所有Jupyter相关进程(包括CMD窗口和浏览器中的Jupyter页面)
- 打开CMD,执行命令:
jupyter notebook --generate-config - 找到生成的配置文件(默认路径为
C:\Users\你的用户名\.jupyter\jupyter_notebook_config.py),打开后定位到c.NotebookApp.use_redirect_file一行,修改为c.NotebookApp.use_redirect_file = False,保存文件 - 重新启动Jupyter Notebook
降级zeromq库
错误日志指向zeromq的epoll模块,Windows不支持epoll,大概率是版本兼容性问题:- 打开Anaconda Prompt(或CMD,确保激活了对应的conda环境)
- 执行命令:
pip install pyzmq==22.3.0 - 重启Jupyter Notebook
更换Jupyter启动目录
当前启动目录包含非英文字符(C:\Users\Стася),特殊字符可能引发文件描述符异常:- 在本地创建纯英文路径的文件夹,例如
D:\Jupyter_Workspace - 打开CMD,通过
cd D:\Jupyter_Workspace切换到该目录 - 执行
jupyter notebook启动服务,再尝试创建新笔记本
- 在本地创建纯英文路径的文件夹,例如
清理Jupyter运行时文件
- 关闭所有Jupyter进程
- 找到Jupyter运行时目录(默认路径为
C:\Users\你的用户名\AppData\Roaming\jupyter\runtime) - 删除该目录下的所有文件
- 重新启动Jupyter Notebook
内容的提问来源于stack exchange,提问作者Kusi_pusi
相关产品推荐
相关产品推荐

