Have you selected the venv as your project interpreter? If not, ctrl+shift+p, search for interpreter and change the interpreter to the one you want. That should work I think Answer from Immotommi on reddit.com
🌐
Visual Studio Code
code.visualstudio.com › docs › python › debugging
Python debugging in VS Code
November 3, 2021 - For general debugging features such as inspecting variables, setting breakpoints, and other activities that aren't language-dependent, review VS Code debugging. This article mainly addresses Python-specific debugging configurations, including the necessary steps for specific app types and remote debugging.
🌐
Medium
sanborse.medium.com › debugging-python-script-in-vscode-e865b7d6dab5
Debugging Python Script in VSCode | by Santosh Borse | Medium
September 30, 2021 - Now you can simply run\debug the code by clicking the green triangle which will run the python code in integrated terminal. ... Simply click a space before line number in open file editor and execution will stop at that point when you debug.
Discussions

VS code not working for python debugging - Python - Code with Mosh Forum
I’ve been facing issues with using python extension with vs code for some weeks now. The debugging doesnt also work. Any help, please?:smiling_face_with_tear: More on forum.codewithmosh.com
🌐 forum.codewithmosh.com
0
June 24, 2022
VSCode / Python / Debugging / venv?
Have you selected the venv as your project interpreter? If not, ctrl+shift+p, search for interpreter and change the interpreter to the one you want. That should work I think More on reddit.com
🌐 r/learnpython
8
26
March 10, 2022
How to debug a Python module in Visual Studio Code's launch.json - Stack Overflow
When I need to run a module, I ... "Run and Debug" tab of the Activity Bar ... Find the answer to your question by asking. Ask question ... See similar questions with these tags. ... New site design and philosophy for Stack Overflow: Starting February 24, 2026... I’m Jody, the Chief Product and Technology Officer at Stack Overflow. Let’s... 35 How to configure VS code for pytest with environment variable · 23 How to make VScode launch.json for a Python ... More on stackoverflow.com
🌐 stackoverflow.com
How to debug remote Python script in VS Code - Stack Overflow
I don't think localhost will work here. Localhost will connect to the machine where vscode is running while we want to connect to the machine where debugpy is running and the IP doesn't have to be a public IP, infact all of this work can be done offline without internet. More on stackoverflow.com
🌐 stackoverflow.com
🌐
Medium
m-ruminer.medium.com › vscode-and-debugging-python-in-virtual-environments-d975125b455c
VSCode and Debugging Python in Virtual Environments | by Michael Ruminer | Medium
January 10, 2026 - You can have the debug window create a launch.json in the .vscode folder of the root workspace directory or create it yourself from scratch. Here is one of my modified ones. { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Python: crewai series day_04", "type": "debugpy", "request": "launch", "program": "${file}", "console": "integratedTerminal", "env": { "PYTHONPATH": "${workspaceFolder}\\crewai_series"
🌐
Visual Studio Code
code.visualstudio.com › docs › python › python-quick-start
Quick Start Guide for Python in VS Code
November 3, 2021 - To start debugging, initialize the debugger by pressing F5. Since this is your first time debugging this file, a configuration menu will open allowing you to select the type of application you want to debug.
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Python Debugger - Visual Studio Marketplace
Extension for Visual Studio Code - Python Debugger extension using debugpy.
🌐
Code with Mosh
forum.codewithmosh.com › python
VS code not working for python debugging - Python - Code with Mosh Forum
June 24, 2022 - I’ve been facing issues with using python extension with vs code for some weeks now. The debugging doesnt also work. Any help, please?🥲
Find elsewhere
🌐
Keploy
keploy.io › home › community › vscode python debugging tips & tricks
VSCode Python Debugging Tips & Tricks | Keploy Blog
August 25, 2025 - Master Python debugging in VSCode with breakpoints, step execution, and variable inspection to fix errors efficiently.
🌐
Codesolid
codesolid.com › debugging-python-in-vs-code
Debugging Python in VS Code — CodeSolid.com 0.1 documentation
That means you can use the same editor and keyboard shortcuts for Python as you use to edit your Bash scripts, JavaScript, and whatever else you may need to do. Unlike PyCharm, you don’t need to pay extra for a “Profession Version” to add support for things like debugging frameworks like Django or working in Docker containers.
🌐
Visual Studio Code
code.visualstudio.com › docs › containers › debug-python
Debug Python within a container
November 3, 2021 - How to configure and troubleshoot debugging of Python apps running in a container, using Visual Studio Code.
🌐
The Chaotic Engineer
chaoticengineer.hashnode.dev › debugging-python-apps-in-vscode
Debugging Python Apps in VSCode
June 7, 2024 - This article covers the usage of Visual Studio Code debugging tools for Python applications. Examples are shown on the FastAPI app running on top of the uvicorn server. The article addresses the following scenarios: ... After reading this article, you will have a comprehensive understanding of the different debugging methods available in VSCode.
🌐
Visual Studio Code
code.visualstudio.com › docs › debugtest › debugging
Debug code with Visual Studio Code
November 3, 2021 - For debugging other languages and runtimes (including PHP, Ruby, Go, C#, Python, C++, PowerShell and many others), look for Debuggers extensions in the Visual Studio Marketplace, or select Install Additional Debuggers in the top-level Run menu.
🌐
Sentry
blog.sentry.io › debugging-python-with-vs-code-and-sentry
Debugging Python with VS Code and Sentry | Sentry
December 13, 2024 - VS Code is now set up to debug the Python script. To launch the script in debugging mode, click the green arrow at the top of the Run and Debug sidebar or press F5 on your keyboard.
🌐
Visual Studio Code
code.visualstudio.com › docs › python › python-tutorial
Getting Started with Python in VS Code
November 3, 2021 - Congrats, you just ran your first Python code in Visual Studio Code! Let's now try debugging our Python program. Debugging support is provided by the Python Debugger extension, which is automatically installed with the Python extension. To ensure it has been installed correctly, open the Extensions view (⇧⌘X (Windows, Linux Ctrl+Shift+X)) and search for @installed python debugger.
Top answer
1 of 4
19

I have resolved this issue. If anyone wants to do remote development and debugging, follow below steps:

  1. Install remote ssh extension in VS code
  2. Once installed, you will find a green icon on the bottom left corner in vs code which allows us to connect to the remote machine.
  3. Connect to the remote machine using the standard ssh command. Alternatively, you can use ssh-keygen to generate a public-private key if you don't want to use the password at every prompt.
  4. Once you are connected to remote machine, you can open the file explorer and create any python file. When you will save this, it will get saved in your remote machine. This way you are using your machine to remotely develop code on another remote machine.
  5. Good thing about vs code is that it selects the remote machine's python interpreter so all the packages which you have installed on your remote machine will work with IntelliSense.
  6. In order to debug the code, we will use debugpy. Install this on both machine (remote & local)
  7. On your remote machine, run below command:

python3 -m debugpy --listen 1.2.3.4:5678 --wait-for-client app.py

here 1.2.3.4 is the IP of remote machine. This will start a remote debugger which will wait for a clients connection.

  1. On your local machine, in VS code open Run & Debug, add a configuration of Python: Remote Attach. Make sure that launch.json has the host as the IP of your remote machine and port as 5678.
  2. Now start debugging as normal and you will notice the code will break at first breakpoint and from here you can proceed normally as we used to do in local debugging process.

TBH, this is best feature VS code has because most of the software allows you to do remote development which is nothing but just a normal SSH but remote debugging gives you more control. I was doing some python project on Raspberry Pi and obviously cannot install VS code or pycharm on it. But with this feature now I can easily develop the code using Pi's python interpreter and debug it as well.

If anyone is having any issues, let me know. Happy to help.

2 of 4
4

It is frustrating there are so many out-dated instructions how to remote debug Python scripts from VSC.

As of August 2024 there is a far easier way to set this up that answers the OP's question which involved VSC being installed on a laptop and debugging a Python script saved on a Raspberry Pi also in the same LAN.

Once you have installed the Remote SSH extension on your local machine use that to SSH via VSC in to your remote machine. Now install the Python Debugger extension on your remote system.

Since you have ssh'd in to that remote system via the VSC extension VSC just debugs the script on that remote system as though it is LOCAL.

  1. Place a breakpoint (red dot) on the line you want script execution to stop at.
  2. From File Menu > Run > Start Debugging (F5)... The Command Palette will open and it will say:
  3. Select Debugger <-- Choose Python Debugger
  4. Then choose...
  5. Python File Debug the currently active Python File.
  6. Now use F10, F11 etc to step through the lines of code.

You DO NOT need to...

  • Do ssh local port forwarding.
  • Separately install debugpy from the command line in your local and remote environments.
  • Run debugpy from the command line.
  • Have a copy of the Python script in your local environment AND another on the remote environment. You only need ONE copy in the remote environment.
  • You don't even need a launch.json.

I checked about what sockets were opened by separately ssh'ing from a Terminal in to the "remote system" (my Raspberry Pi running Ubuntu) and they are all localhost.

ubuntu@ubuntu:~$ lsof -i
COMMAND     PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
code-f1e1 76603 ubuntu    9u  IPv4 519530      0t0  TCP localhost:43675 (LISTEN)
code-f1e1 76603 ubuntu   12u  IPv4 519534      0t0  TCP localhost:43675->localhost:34540 (ESTABLISHED)
python    77190 ubuntu    4u  IPv4 520559      0t0  TCP localhost:39819 (LISTEN)
python    77190 ubuntu    8u  IPv4 522535      0t0  TCP localhost:45381 (LISTEN)
python    77190 ubuntu    9u  IPv4 521557      0t0  TCP localhost:45381->localhost:59082 (ESTABLISHED)
python    77190 ubuntu   11u  IPv4 521558      0t0  TCP localhost:35979->localhost:37454 (ESTABLISHED)
python    77218 ubuntu    3u  IPv4 520157      0t0  TCP localhost:37454->localhost:35979 (ESTABLISHED)
python    77228 ubuntu    3u  IPv4 520164      0t0  TCP localhost:59082->localhost:45381 (ESTABLISHED)
🌐
Qt
doc.qt.io › qtforpython-6 › tutorials › debugging › vscode › vscode.html
Debugging PySide with VSCode (Linux + Windows) - Qt for Python
Run “(gdb) Attach” or “(Windows) Attach” and this should ask you for the processId of the Python process to which you want to attach the C++ debugger. VSCode also lets you search for the process by its name.
🌐
GitHub
github.com › microsoft › vscode-python › discussions › 21193
Can we start vscode debugger directly from terminal with `python --pdb`? · microsoft/vscode-python · Discussion #21193
pip install debugpy python -m debugpy --listen 5678 --wait-for-client your_command.py ... Your IDE breakpoints work as usual. This respects VS Code’s architecture and avoids manual breakpoint() calls. References: ... Working on a PR to include a simple attach wrapper in vscode-python examples.
Author   microsoft
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-debug-a-python-module-in-vscode
How to debug a python module in VSCode - GeeksforGeeks
July 23, 2025 - This article will guide you through the process of setting up and using VSCode to debug a Python module, from initial setup to advanced debugging techniques.
🌐
Medium
medium.com › @jonathan_b › debugging-in-visual-studio-code-a-python-app-with-arguments-8d75a69bbd66
Debugging in Visual Studio Code — A Python app with arguments | by BLAKELY | Medium
June 25, 2024 - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Python Debugger: Current File with Arguments", "type": "debugpy", "request": "launch", "program": "${workspaceFolder}/my_project/runner.py", "console": "integratedTerminal", "args": ["arg1", "arg2"] } ] }