Jupyter notebook freezes on start/kernel restart

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Jupyter kernels launched from Python virtual environments (.venv) freeze immediately upon startup or kernel restart, before executing any code cells.

The kernel process starts successfully and establishes network connections, but then hangs indefinitely during the initial handshake/communication phase with Cursor.

Key symptoms:

  • Kernel starts (process visible, ports listening)
  • Kernel establishes TCP connections to Cursor’s Node.js process
  • Kernel freezes before executing even the first cell (import io)
  • No error messages, kernel appears to be waiting indefinitely
  • Same kernel works fine when launched outside Cursor (e.g., via jupyter notebook CLI)
  • Standalone Python interpreters (not in venv) work fine in Cursor
  • Issue is specific to venv-based kernels

Technical details from debugging:

  • Kernel process (PID 4612) shows state: S (sleeping) with 12 threads
  • All threads waiting on epoll_wait() calls (normal I/O waiting)
  • TCP connections established: kernel listening on ports 9008-9012, connected to Cursor’s Node.js process (PID 1172)
  • Reading from kernel’s stdout/stderr pipes causes infinite hang
  • No messages being exchanged between Cursor and kernel (strace shows no sendmsg/recvmsg activity)
  • Python 3.13.0, ipykernel 7.1.0, pyzmq 27.1.0, tornado 6.5.4

Steps to Reproduce

  1. Create a Python project with a virtual environment:

    mkdir test-project
    cd test-project
    python3.13 -m venv .venv
    .venv/bin/pip install ipykernel pandas numpy
    
  2. Create a simple Jupyter notebook (test.ipynb) with a single cell:

    import io
    
  3. Open the notebook in Cursor IDE

  4. Select the .venv Python interpreter as the kernel

  5. Try to execute the first cell

(NOTE: sometimes it works when the notebook is created for the first time, but it freezes after kernel restart or after closing the file and relaunching it / running it for the second time)

Expected Behavior

  • Cell executes successfully
  • Output shows execution completed

Operating System

Linux

Version Information

Version: 2.3.41 (system setup)
VSCode Version: 1.105.1
Commit: 2ca326e0d1ce10956aea33d54c0e2d8c13c58a30
Date: 2026-01-16T19:14:00.150Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.26100

Additional Information

Operating system:

WSL Ubuntu 24

Process analysis:

# Kernel process details
PID: 4612
Command: /path/to/.venv/bin/python -m ipykernel_launcher --f=/run/user/1000/jupyter/runtime/kernel-*.json
State: S (sleeping)
Threads: 12

Network connections:

  • Kernel listening on: 127.0.0.1:9008-9012
  • Connected to Cursor Node.js process (PID 1172)
  • Connections established but no data exchange

System calls (strace):

  • All threads waiting on epoll_wait() - normal I/O waiting
  • No sendmsg/recvmsg activity (no ZMQ message exchange)
  • Reading from stdout/stderr pipes hangs indefinitely

What works:

  • Same kernel works when launched via jupyter notebook CLI
  • System Python (non-venv) kernels work in Cursor
  • Kernel can be manually started: .venv/bin/python -m ipykernel_launcher works
  • Python imports work fine: .venv/bin/python -c "import io" succeeds

What doesn’t work:

  • Cursor launching venv kernel and establishing communication
  • Executing any cells when using venv kernel
  • Interrupting frozen kernel (must kill process manually)

Does this stop you from using Cursor

Yes - Cursor is unusable

1 Like

Thanks for the detailed bug report. I’ll flag this for the team to investigate.