微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Python 停止在 Jupyter 启动上工作

如何解决Python 停止在 Jupyter 启动上工作

我从我的 powershell 提示jupyter notebook 启动 Jupyter 并且它正确加载,但是当我打开一个新的或现有的笔记本时,内核会占用大约 10 秒,然后我收到一个弹出窗口,说 Python 有停止工作。在我的终端中,我得到 Invalid argument (C:\ci\zeromq_1602704446950\work\src\epoll.cpp:100)(见下文)。有什么解决办法吗?我尝试使用不同的环境并卸载/重新安装 pyzmq

[I 12:58:16.682 NotebookApp] Serving notebooks from local directory: C:\Users\tobinp
[I 12:58:16.682 NotebookApp] Jupyter Notebook 6.1.6 is running at:
[I 12:58:16.684 NotebookApp] http://localhost:8888/?token=9eee2cc4e598b193ad42fc05ff620a43d0e5f29e885170b3
[I 12:58:16.684 NotebookApp]  or http://127.0.0.1:8888/?token=9eee2cc4e598b193ad42fc05ff620a43d0e5f29e885170b3
[I 12:58:16.685 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 12:58:18.289 NotebookApp]

To access the notebook,open this file in a browser: file:///C:/Users/tobinp/AppData/Roaming/jupyter/runtime/nbserver-18144-open.html Or copy and paste one of these URLs: http://localhost:8888/?token=7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx6 or http://127.0.0.1:8888/?token=7xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx6
Invalid argument (C:\ci\zeromq_1602704446950\work\src\epoll.cpp:100)

解决方法

这是我第三次看到此类问题,它们都发生在 2021 年 1 月,这似乎是我们所有人的主要问题。我安装了Windows 10和python环境20多次,包括Windows 10 1909、20H2、python 3.6.8 3.7.9 3.8.6 3.8.7,问题依然存在。这个问题困惑了我两个多星期,原本以为是tensorflow问题、CUDA 11.0问题、cuDNN问题、vc++库问题甚至RTX 30系列GPU。

解决方案: 此错误与您的 pyzmq 库有关。最近,当我为我的新计算机设置一个全新的 python 环境时,它也给我带来了麻烦。我只是使用 pip install jupyterlab 安装 jupyterlab(或 jupyter notebook),然后就会出现问题。然后,我查看了包的依赖,pyzmq是因为我安装了jupyterlab(或者jupyter notebook),jupyterlab需要ipykernel,ipykernel需要pyzmq,安装了更高版本的pyzmq。

我所做的对我有用的是pip uninstall pyzmq,然后

将其降级到较低版本pip install pyzmq==19.0.2 这样就解决了python内核崩溃的问题。

避免此问题的另一种方法是在 Ubuntu 18.04 上安装所有环境,这对我有用,它暂时帮助我避免了此问题。使用Anaconda可能可以避免这个问题,但是我在Anaconda中使用tensorflow时遇到了问题,所以最后没有使用Anaconda。

那么,我的建议是,如果你的环境是固定的,备份你的系统,当问题再次出现时恢复系统。

我也贴了一个github问题链接:https://github.com/zeromq/pyzmq/issues/1505,如果你有类似的问题,你可以贴在那里。

,

我遇到了类似的问题:今天,在将 Jupyter 更新到最新版本后,我无法从 Windows Powershell 启动“jupyter notebook”命令,回溯如下:“ImportError: DLL load failed while importing libzmq”。 我用pyzmq回滚解决了,从最新版本(21.0.1)到19.0.2(我的环境中安装了我以前的版本)。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。