Unable to run a Python module in a subprocess when `subProcess: true`
@rchiodo is already working on this.
Since Feb 23, 2026.
Assessment
This issue has not been assessed yet.
Description
The following script executes a Python module in a subprocess.
# main.py
import subprocess
import sys
subprocess.run([sys.executable, "-m", "sub"])
# sub.py
print("Hello, world!")
// launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"subProcess": true,
}
]
}
Running this in the debugger with "subProcess": true fails:
bash-3.2$ cd /Users/pete/projects/subprocess_test ; /usr/bin/env /Users/pete/projects/subprocess_test/.venv/bin/python /Users/pete/.vscode/extensions/ms-python.debugpy-2025.18.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher 56894 -- /Users/pete/projects/subprocess_test/main.py
No module named sub
Running it with "subProcess": false works as expected:
bash-3.2$ cd /Users/pete/projects/subprocess_test ; /usr/bin/env /Users/pete/projects/subprocess_test/.venv/bin/python /Users/pete/.vscode/extensions/ms-python.debugpy-2025.18.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher 57618 -- /Users/pete/projects/subprocess_test/main.py
Hello, world!
OS: Darwin arm64 25.3.0
VSCode: 1.109.5 (Universal)
Python Debugger: 2025.18.0
Python: 3.14.2 (in a virtualenv)
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 202
- Avg merge
- 5d 1h
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/debugpy
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
All issues in microsoft/debugpy
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
canonical/paas-charm#368 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
tech debt
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
StevenBlack/hosts#3256 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
qualcomm/qai-appbuilder#275 ·