Skip to content

Slow Startup When Using VSCode Debugger with Matplotlib Installation via CLI Model Configuration in PyTorch Lightning #20699

@lengmo1996

Description

@lengmo1996

Bug description

When configuring models using the command-line interface (CLI) in PyTorch Lightning and attempting to debug with VSCode Debugger, the startup process is significantly slow. This issue specifically occurs during the initialization phase of the debugging session.

What version are you seeing the problem on?

v2.5

How to reproduce the bug

1. Pull a docker image from docker hub by 'docker pull pytorchlightning/pytorch_lightning:2.5.1-py3.12-torch2.5-cuda12.1.1'
2. Create a container from the image.
3. Connect the container by vscode and install some python extensions.
4. Set up vscode debugger for debugging
5. Initiate a debug sesscion to debug the following python code.

# from lightning.pytorch.demos import BoringDataModule, BoringModel
from lightning.pytorch.cli import (
    LightningCLI,
)

if __name__ == "__main__":
    LightningCLI()

Error messages and logs

# Error messages and logs here please

Environment

Current environment
  • VSCODE:
    - Version: 1.97.2 (system setup)
    - Submit: e54c774e0add60467559eb0d1e229c6452cf8447
    - Date: 2025-02-12T23:20:35.343Z
    - Electron: 32.2.7
    - ElectronBuildId: 10982180
    - Chromium: 128.0.6613.186
    - Node.js: 20.18.1
    - V8: 12.8.374.38-electron.0
    - OS: Windows_NT x64 10.0.19045
  • VSCODE Extension:
    - Pylance (ms-python.vscode-pylance): 2025.4.1
    - Python (ms-python.python): 2024.4.1
    - Python Debugger (ms-python.debugpy): 2025.6.0
  • CUDA:
    - GPU:
    - NVIDIA GeForce RTX 3090
    - NVIDIA GeForce RTX 3090
    - available: True
    - version: 12.1
  • Lightning:
    - lightning: 2.5.1
    - lightning-utilities: 0.11.9
    - pytorch-lightning: 2.5.1
    - torch: 2.5.1+cu121
    - torchmetrics: 1.4.3
  • Packages:
    - absl-py: 2.1.0
    - aiohappyeyeballs: 2.6.1
    - aiohttp: 3.11.14
    - aiosignal: 1.3.2
    - antlr4-python3-runtime: 4.9.3
    - anyio: 4.9.0
    - attrs: 25.3.0
    - autocommand: 2.2.2
    - backports.tarfile: 1.2.0
    - bitsandbytes: 0.45.2
    - blinker: 1.4
    - cachetools: 5.5.2
    - certifi: 2025.1.31
    - charset-normalizer: 3.4.1
    - click: 8.1.8
    - cloudpickle: 2.2.1
    - coloredlogs: 15.0.1
    - contourpy: 1.3.1
    - coverage: 7.3.1
    - cryptography: 3.4.8
    - cycler: 0.12.1
    - dbus-python: 1.2.18
    - deepspeed: 0.9.3
    - distro: 1.7.0
    - docstring-parser: 0.16
    - fastapi: 0.115.11
    - filelock: 3.18.0
    - flatbuffers: 25.2.10
    - fonttools: 4.56.0
    - frozenlist: 1.5.0
    - fsspec: 2024.3.1
    - google-auth: 2.38.0
    - google-auth-oauthlib: 1.0.0
    - grpcio: 1.71.0
    - h11: 0.14.0
    - hjson: 3.1.0
    - httplib2: 0.20.2
    - humanfriendly: 10.0
    - hydra-core: 1.3.2
    - idna: 3.10
    - importlib-metadata: 4.6.4
    - importlib-resources: 6.5.2
    - inflect: 7.3.1
    - iniconfig: 2.0.0
    - jaraco.collections: 5.1.0
    - jaraco.context: 5.3.0
    - jaraco.functools: 4.0.1
    - jaraco.text: 3.12.1
    - jeepney: 0.7.1
    - jinja2: 3.1.6
    - joblib: 1.4.2
    - jsonargparse: 4.35.0
    - keyring: 23.5.0
    - kiwisolver: 1.4.8
    - launchpadlib: 1.10.16
    - lazr.restfulclient: 0.14.4
    - lazr.uri: 1.0.6
    - lightning: 2.5.1
    - lightning-utilities: 0.11.9
    - markdown: 3.7
    - markdown-it-py: 3.0.0
    - markupsafe: 3.0.2
    - matplotlib: 3.10.1
    - mdurl: 0.1.2
    - more-itertools: 8.10.0
    - mpmath: 1.3.0
    - multidict: 6.2.0
    - networkx: 3.4.2
    - ninja: 1.11.1.3
    - numpy: 1.26.4
    - nvidia-cublas-cu12: 12.1.3.1
    - nvidia-cuda-cupti-cu12: 12.1.105
    - nvidia-cuda-nvrtc-cu12: 12.1.105
    - nvidia-cuda-runtime-cu12: 12.1.105
    - nvidia-cudnn-cu12: 9.1.0.70
    - nvidia-cufft-cu12: 11.0.2.54
    - nvidia-curand-cu12: 10.3.2.106
    - nvidia-cusolver-cu12: 11.4.5.107
    - nvidia-cusparse-cu12: 12.1.0.106
    - nvidia-nccl-cu12: 2.21.5
    - nvidia-nvjitlink-cu12: 12.8.93
    - nvidia-nvtx-cu12: 12.1.105
    - oauthlib: 3.2.0
    - omegaconf: 2.3.0
    - onnx: 1.16.2
    - onnxruntime: 1.18.1
    - packaging: 23.1
    - pandas: 2.1.4
    - pillow: 11.1.0
    - pip: 25.0.1
    - platformdirs: 4.2.2
    - pluggy: 1.5.0
    - propcache: 0.3.0
    - protobuf: 6.30.1
    - psutil: 5.9.5
    - py-cpuinfo: 9.0.0
    - pyasn1: 0.6.1
    - pyasn1-modules: 0.4.1
    - pydantic: 1.10.21
    - pygments: 2.19.1
    - pygobject: 3.42.1
    - pyjwt: 2.3.0
    - pyparsing: 2.4.7
    - pytest: 7.4.0
    - pytest-cov: 4.1.0
    - pytest-random-order: 1.1.0
    - pytest-rerunfailures: 12.0
    - pytest-timeout: 2.1.0
    - python-apt: 2.4.0+ubuntu4
    - python-dateutil: 2.9.0.post0
    - pytorch-lightning: 2.5.1
    - pytz: 2025.1
    - pyyaml: 6.0.2
    - requests: 2.32.3
    - requests-oauthlib: 2.0.0
    - rich: 13.5.3
    - rsa: 4.9
    - scikit-learn: 1.3.2
    - scipy: 1.15.2
    - secretstorage: 3.3.1
    - setuptools: 75.6.0
    - six: 1.16.0
    - sniffio: 1.3.1
    - starlette: 0.46.1
    - sympy: 1.13.1
    - tensorboard: 2.14.1
    - tensorboard-data-server: 0.7.2
    - tensorboardx: 2.6.2.2
    - threadpoolctl: 3.6.0
    - tomli: 2.0.1
    - torch: 2.5.1+cu121
    - torchmetrics: 1.4.3
    - tqdm: 4.66.6
    - triton: 3.1.0
    - typeguard: 4.3.0
    - typeshed-client: 2.7.0
    - typing-extensions: 4.10.0
    - tzdata: 2025.1
    - urllib3: 2.3.0
    - uvicorn: 0.34.0
    - wadllib: 1.3.6
    - werkzeug: 3.1.3
    - wget: 3.2
    - wheel: 0.43.0
    - yarl: 1.18.3
    - zipp: 1.0.0
  • System:
    - OS: Linux
    - architecture:
    - 64bit
    - ELF
    - processor: x86_64
    - python: 3.12.9
    - release: 5.15.0-131-generic
    - version: Error if dataset size = 1 batch. #141~20.04.1-Ubuntu SMP Thu Jan 16 18:38:51 UTC 2025

More info

No response

cc @mauvilsa

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions