Python Stopped Working on Jupyter StartUp

Viewed 4931

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)
5 Answers

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.

I had a similar problem: today, after updating Jupyter to the latest version, I was not able to launch "jupyter notebook" command from Windows Powershell, with the following Traceback: "ImportError: DLL load failed while importing libzmq". I solved with pyzmq roll back, from latest version (21.0.1) to 19.0.2 (my previous version installed in my environment).

A friend's laptop has the same problem. She has downloaded the latest version (Anaconda3-2021.05-Windows-x86_64.exe) installed it on Windows 10. When trying to launch jupyter notebook, it has a problem connecting to the kernel ( Python3 or IPykernel). I spent 2 hours using Zoom remote desktop to work on it, like update, checking the logs, create a new environment and remove and reinstall. There's no good news until I came across the idea about lower the version of Pyzmq. It's simple and quick fix to the problem as concluded below:

  1. Step 1 Open the Anaconda Prompt (no need to run it as administrator)
  2. Step 2 Uninstall pyzmq: pip uninstall pyzmq
  3. Step 3 Install it with desired version: pip install pyzmq==19.0.2

Strange enough when I removed the Anaconda 3 on my PC (installed a couple years ago) and reinstalled the latest version. It has no problem connecting to the kernel!

I had the same problem and couldn't figure out why.

I'm running windows 11 and python 3.10 and had installed python via the Microsoft store. I tried kegemo's solution but was not allowed to perform pip install pyzmq==19.0.2 due to an error with the installation wheel.

I solved it simply by uninstalling python and instead installing it via the installation file from https://www.python.org/downloads/.

I followed your advice and uninstalled the latest pyzmq version (24.0.1), then installed the 19.0.2 version. However, an message pops up saying that the current version of Jupyter (I only installed jupyter notebook, not even jupyter Lab) requires at least version 23 of pyzmq...

Screenshot Command prompt

It doesn't seem to be a problem though. I am now able to successfully run a notebook without any error. And the notebook works just fine, no problem so far.

Related