Unable to attach debugger after ipykernel/debugger.py gets imported

Open
#975 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
devtools

Research direction

Start with the import path from InProcessKernelManager() into ipykernel/debugger.py and reproduce the failure using a fresh ipykernel 6.3.0-or-newer environment. Check the PyCharm or VS Code debugger attach behavior; done means the debugger can attach without replacing ipykernel.debugger with a fake module.

Written by the indexing model from the issue text.

Description

The problem starts at version ipykernel==6.3.0 and up. I created a fresh venv in PyCharm and this is what I see in the "Python Window" when clicking the "Attach Debugger" button:

image
image
image

When I use the PyCharm "Debug Server" it locks up forever when trying to connect.

Other team members using vscode are having the same problem.

I'm currently working around the problem with this code at launch of product:

class FakeDebuggerModule:
  Debugger = None
  _is_debugpy_available = False
import sys
sys.modules['ipykernel.debugger'] = FakeDebuggerModule

The code my application is running which causes debugger.py to get imported is:

from ipykernel.inprocess import InProcessKernelManager
InProcessKernelManager()
Dominant language
Python
Stars
734
Forks
411
Avg merge
1d 2h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ipython/ipykernel

All issues in ipython/ipykernel

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.