Skip to content

pdb - based debugging with RichProgressBar doesn't show input #10607

@keyraphi

Description

@keyraphi

🐛 Bug

RichProgressBar swallows the input for pdb or pdbr which makes debugging with those tools virtually impossible.
This is a known issue in rich which does not yet have a solution: See here
With RichProgressBar on the way of replacing tqdm as default it would be good to either document a workaround, or to reconsider that decision.

To Reproduce

Use RichProgressBar in the Trainer callback and put

import pdb; pdb.set_trace()

or

breakpoint()

somewhere inside the training_step(...) or validation_step(...) of your module.

If the execution stops at that breakpoint you will still get the (Pdb) repl, which also works. However the input will not be shown which makes you blind when typing pdb commands.

For example with the RichProgressBar:

...
(Pdb) 
Validation Sanity Check ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/2 0:00:08-:--:-- 0.00it/s
'Hello World!' 
(Pdb)

Note that the input `p "Hello World!" is not shown. It should appear in the repl behind (Pdb)
The same Example with ProgressBar

...
(Pdb) p "Hello World!"
'Hello World!'
(Pdb)

Expected behavior

The input to pdb is shown when typed.

Environment

  • PyTorch Lightning Version (e.g., 1.3.0): 1.5.1
  • PyTorch Version (e.g., 1.8): 1.10.0+cu113
  • Python version: 2.8.10
  • OS (e.g., Linux): Linux
  • CUDA/cuDNN version: 11.3 / 8.2
  • GPU models and configuration: Not relevant
  • How you installed PyTorch (conda, pip, source): pip
  • If compiling from source, the output of torch.__config__.show():
  • Any other relevant information:

Additional context

This is not a bug that can/should be fixed in pytorch-lighting. However now that the progress-bar is in PytorchLightning we need this to be pointed out in the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions