pythonwindowsjupyter-notebookzeromqpyzmq

Python Stopped Working on Jupyter StartUp


I start Jupyter from my powershell prompt jupyter notebook and it loads up correctly, but when I open a new or existing notebook, the kernel sits busy for about 10 sec and then I get a pop-up saying Python has stopped working. In my terminal I get Invalid argument (C:\ci\zeromq_1602704446950\work\src\epoll.cpp:100) (see below). Any solutions off the top of your head? I've tried using different environments and uninstalling/reinstalling 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)

Solution

  • This is the third time I saw this kind of issue, and they all happened in January 2021, it seems to be a major issue for all of us. I installed Windows 10 and python environment more than 20 times, including Windows 10 1909, 20H2, python 3.6.8 3.7.9 3.8.6 3.8.7, the problem still exist. This problem confused me for more than two weeks, and I originally thought it was tensorflow problem, CUDA 11.0 problem, cuDNN problem, vc++ library problem or even the RTX 30 series GPU.

    Solution: This error is related to your pyzmq library. It also troubles to me when I setup a brand new python environment for my new computer, recently. I just install jupyterlab (or jupyter notebook) by using pip install jupyterlab and then the problem will arise. Then, I checked the dependencies of the package, pyzmq is installed because I installed jupyterlab (or jupyter notebook), jupyterlab needs ipykernel, ipykernel needs pyzmq, and a higher version of pyzmq is installed.

    What I did useful for me is pip uninstall pyzmq,and then

    degrade it to a lower version pip install pyzmq==19.0.2 This solves the crash problem of python kernel.

    Another way to avoid this issue is to install all your environment on Ubuntu 18.04, this works for me, it temporarily helped me to avoid this issue. Using Anaconda may avoid this issue, but I encountered problem using tensorflow in Anaconda, so I did not use Anaconda in the end.

    Then, I would suggest is that, if the environment is fixed for you, backup for your system, restore the system when the problem arise again.

    I also posted a github issue link: https://github.com/zeromq/pyzmq/issues/1505, if you have similiar issue, you could post it there.