nvim-dap-python
nvim-dap-python copied to clipboard
debugpy: Timed out waiting for debuggee to spawn
I'm trying to setup Neovim with nvim-dap, nvim-dap-python and debugpy. Since I have debugpy in my distribution packages I installed it not via a virtual environment but directly in the system. For Neovim, I use lazy as package manager.
For nvim-dap-python, I use this config:
require('dap-python').setup("/usr/bin/python")
My /usr/bin/python
resolves to Python 3.11.
When starting a debugging session, it seems to work, but timeouts after a short time and both Neovim as well as debugpy seem to report that they didn't get a connection.
Here are the steps that I have done followed by the log.
Executed steps:
- Open a file
test.py
. - Add this content:
#!/usr/bin/env python
print("hello")
- Save it.
- Set a breakpoint at the
print
line. -> a B appears at the left side. - Execute: `:lua require('dap').set_log_level('TRACE')
- Start the debugger with F5 (
require('dap').continue()
) - Choose
Launch file
A message appears:
Debug adapter didn't respond. Either the adapter is slow (then wait and ignore this) or there is a problem with your adapter or `python` configuration. Check the logs for errors (:help dap.set_log_level)
The log file
[ DEBUG ] 2023-04-05T01:41:51Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1239 ] "Spawning debug adapter" {
args = { "-m", "debugpy.adapter" },
command = "/usr/bin/python",
enrich_config = <function 1>,
options = {
source_filetype = "python"
},
type = "executable"
}
[ DEBUG ] 2023-04-05T01:41:51Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1544 ] "request" {
arguments = {
adapterID = "nvim-dap",
clientId = "neovim",
clientname = "neovim",
columnsStartAt1 = true,
linesStartAt1 = true,
locale = "de_DE.UTF-8",
pathFormat = "path",
supportsProgressReporting = true,
supportsRunInTerminalRequest = true,
supportsStartDebuggingRequest = true,
supportsVariableType = true
},
command = "initialize",
seq = 0,
type = "request"
}
[ DEBUG ] 2023-04-05T01:41:51Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:917 ] 1 {
body = {
category = "telemetry",
data = {
packageVersion = "1.6.6"
},
output = "ptvsd"
},
event = "output",
seq = 1,
type = "event"
}
[ DEBUG ] 2023-04-05T01:41:51Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:917 ] 1 {
body = {
category = "telemetry",
data = {
packageVersion = "1.6.6"
},
output = "debugpy"
},
event = "output",
seq = 2,
type = "event"
}
[ INFO ] 2023-04-05T01:41:51Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:711 ] "Telemetry" "ptvsd"
[ DEBUG ] 2023-04-05T01:41:51Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:917 ] 1 {
body = {
exceptionBreakpointFilters = { {
default = false,
description = "Break whenever any exception is raised.",
filter = "raised",
label = "Raised Exceptions"
}, {
default = true,
description = "Break when the process is exiting due to unhandled exception.",
filter = "uncaught",
label = "Uncaught Exceptions"
}, {
default = false,
description = "Break when exception escapes into library code.",
filter = "userUnhandled",
label = "User Uncaught Exceptions"
} },
supportsClipboardContext = true,
supportsCompletionsRequest = true,
supportsConditionalBreakpoints = true,
supportsConfigurationDoneRequest = true,
supportsDebuggerProperties = true,
supportsDelayedStackTraceLoading = true,
supportsEvaluateForHovers = true,
supportsExceptionInfoRequest = true,
supportsExceptionOptions = true,
supportsFunctionBreakpoints = true,
supportsGotoTargetsRequest = true,
supportsHitConditionalBreakpoints = true,
supportsLogPoints = true,
supportsModulesRequest = true,
supportsSetExpression = true,
supportsSetVariable = true,
supportsStepInTargetsRequest = true,
supportsTerminateRequest = true,
supportsValueFormattingOptions = true
},
command = "initialize",
request_seq = 0,
seq = 3,
success = true,
type = "response"
}
[ INFO ] 2023-04-05T01:41:51Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:711 ] "Telemetry" "debugpy"
[ DEBUG ] 2023-04-05T01:41:51Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1544 ] "request" {
arguments = {
console = "integratedTerminal",
name = "Launch file",
program = "/home/gerion/test/test.py",
request = "launch",
type = "python"
},
command = "launch",
seq = 1,
type = "request"
}
[ DEBUG ] 2023-04-05T01:41:51Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:917 ] 1 {
arguments = {
args = { "/usr/lib/python-exec/python3.11/python", "/usr/lib/python3.11/site-packages/debugpy/launcher", "55627", "--", "/home/gerion/test/test.py" },
cwd = "/home/gerion/test",
env = vim.empty_dict(),
kind = "integrated",
title = "Python Debug Console"
},
command = "runInTerminal",
seq = 4,
type = "request"
}
[ DEBUG ] 2023-04-05T01:41:51Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:203 ] "run_in_terminal" {
args = { "/usr/lib/python-exec/python3.11/python", "/usr/lib/python3.11/site-packages/debugpy/launcher", "55627", "--", "/home/gerion/test/test.py" },
cwd = "/home/gerion/test",
env = vim.empty_dict(),
kind = "integrated",
title = "Python Debug Console"
}
[ DEBUG ] 2023-04-05T01:41:51Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1574 ] "response" {
body = {
processId = 239043
},
command = "runInTerminal",
request_seq = 4,
seq = 2,
success = true,
type = "response"
}
[ DEBUG ] 2023-04-05T01:42:32Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:917 ] 1 {
command = "launch",
message = "Timed out waiting for debuggee to spawn",
request_seq = 1,
seq = 5,
success = false,
type = "response"
}
[ DEBUG ] 2023-04-05T01:42:32Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:917 ] 1 {
body = {
exitCode = 1
},
event = "exited",
seq = 6,
type = "event"
}
[ DEBUG ] 2023-04-05T01:42:32Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:917 ] 1 {
event = "terminated",
seq = 7,
type = "event"
}
Especially the line Timed out waiting for debuggee to spawn
seems to come from the debugpy, so it seems that they fail to communicate. Do you have an idea, why this happens? Or can you point out, how to debug the debugger? :)
Additional information
When I call the above command manually, this happens:
$ /usr/lib/python-exec/python3.11/python "/usr/lib/python3.11/site-packages/debugpy/launcher" 55627 -- /home/gerion/test/test.py
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/usr/lib/python3.11/site-packages/debugpy/launcher/__main__.py", line 91, in <module>
main()
File "/usr/lib/python3.11/site-packages/debugpy/launcher/__main__.py", line 47, in main
launcher.connect(host, port)
File "/usr/lib/python3.11/site-packages/debugpy/launcher/../../debugpy/launcher/__init__.py", line 27, in connect
sock.connect((host, port))
ConnectionRefusedError: [Errno 111] Verbindungsaufbau abgelehnt
Probably Neovim/nvim-dap does not create the necessary socket for communication here, so that it fails. But the example shows that debugpy is installed and Python can call it.
I forgot to mention the versions:
- Neovim 0.8.3
- debugpy 1.6.6
- nvim-dap 0.5.0
- nvim-dap-python, commit b21f707b3
Looks like the debugee process can't connect back to the debug adapter. Do you have some firewall rules active or something?
The overall way how debugpy works is a bit complex. It looks roughly like this:
- nvim-dap spawns the debugpy process
- The debugpy listens via TCP on a port
- nvim-dap tells debugpy it wants to launch a process (that's your
launch
configuration, in your case fortest.py
) - Given that
runInTerminal
is used (set by default in nvim-dap-python). debugpy now tells nvim-dap that it should run/path/to/launcher <somePort> -- /path/to/your/app
. - nvim-dap runs this process in a neovim terminal buffer
- The
launcher
process tries to connect to<somePort>
This step seems to fail, because the original debugpy
process sends nvim-dap an error:
Timed out waiting for debuggee to spawn
Which means that the launcher
process couldn't connect to <somePort>
. In the logs you provded the port was 55627
The setup itself otherwise looks okay, and using a debugpy
system package is supported and should in general work.
Looks like the debugee process can't connect back to the debug adapter. Do you have some firewall rules active or something?
No. TCP ports should just work.
The overall way how debugpy works is a bit complex. It looks roughly like this:
- nvim-dap spawns the debugpy process
- The debugpy listens via TCP on a port
- nvim-dap tells debugpy it wants to launch a process (that's your
launch
configuration, in your case fortest.py
)- Given that
runInTerminal
is used (set by default in nvim-dap-python). debugpy now tells nvim-dap that it should run/path/to/launcher <somePort> -- /path/to/your/app
.- nvim-dap runs this process in a neovim terminal buffer
- The
launcher
process tries to connect to<somePort>
Thanks for the explanation. I did a new test in which I try to start the debugger while running watch -n 0.2 netstat -tulpen
simultaneously.
The log for this run is:
[ DEBUG ] 2023-04-13T14:59:54Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:917 ] 2 {
arguments = {
args = { "/usr/lib/python-exec/python3.11/python", "/usr/lib/python3.11/site-packages/debugpy/launcher", "50761", "--", "/home/gerion/test/test.py" },
cwd = "/home/gerion/test",
env = vim.empty_dict(),
kind = "integrated",
title = "Python Debug Console"
},
command = "runInTerminal",
seq = 4,
type = "request"
}
[ DEBUG ] 2023-04-13T14:59:54Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:203 ] "run_in_terminal" {
args = { "/usr/lib/python-exec/python3.11/python", "/usr/lib/python3.11/site-packages/debugpy/launcher", "50761", "--", "/home/gerion/test/test.py" },
cwd = "/home/gerion/test",
env = vim.empty_dict(),
kind = "integrated",
title = "Python Debug Console"
}
[ DEBUG ] 2023-04-13T14:59:54Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1574 ] "response" {
body = {
processId = 271210
},
command = "runInTerminal",
request_seq = 4,
seq = 2,
success = true,
type = "response"
}
[ DEBUG ] 2023-04-13T15:00:09Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:917 ] 2 {
command = "launch",
message = "Timed out waiting for debuggee to spawn",
request_seq = 1,
seq = 5,
success = false,
type = "response"
}
However, the output of netstat -tulpen
is:
...
tcp 0 0 127.0.0.1:48197 0.0.0.0:* LISTEN 1000 3016181 271200/python
tcp 0 0 127.0.0.1:58777 0.0.0.0:* LISTEN 1000 3018718 271200/python
...
The python process spawns immediately, when I execute DapContinue
-> Launch File
. Also, netstat lists no other python processes than that. It listens on two ports, but both of them are different than the one mentioned in the log. Is that the cause of the error? Also, why does it listens on two ports?
Do you know a way to reproduce the debugpy behavior without the surrounding Neovim (since the direct execution of the command does not work)?
Do you know a way to reproduce the debugpy behavior without the surrounding Neovim (since the direct execution of the command does not work)?
No, but you could try enabling logs for debugpy by setting the DEBUGPY_LOG_DIR
env variable. E.g. export DEBUGPY_LOG_DIR=/tmp/debugpy/
.
Thanks, I tried it with the log. However, they are strange. The relevant Neovim-dap-log is:
[ DEBUG ] 2023-04-14T00:32:31Z+0200 ] ...rion/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:203 ] "run_in_terminal" {
args = { "/usr/lib/python-exec/python3.11/python", "/usr/lib/python3.11/site-packages/debugpy/launcher", "51953", "--", "/home/gerion/test/test.py" },
cwd = "/home/gerion/test",
env = {
DEBUGPY_LOG_DIR = "/home/gerion/test/debugpy"
},
kind = "integrated",
title = "Python Debug Console"
}
debugpy.launcher-297311.log
I+00000.008: Linux-6.2.8-gentoo-dist-x86_64-AMD_Ryzen_7_PRO_6850U_with_Radeon_Graphics-with-glibc2.36 x86_64
CPython 3.11.2 (64-bit)
debugpy 1.6.6
I+00000.010: debugpy.launcher startup environment:
System paths:
sys.prefix: /usr
sys.base_prefix: /usr
sys.real_prefix: <missing>
site.getsitepackages(): /usr/lib/python3.11/site-packages
site.getusersitepackages(): /home/gerion/.local/lib/python3.11/site-packages
sys.path (site-packages): /usr/lib/python3.11/site-packages
sysconfig.get_path('stdlib'): /usr/lib/python3.11
sysconfig.get_path('platstdlib'): /usr/lib/python3.11
sysconfig.get_path('purelib'): /usr/lib/python3.11/site-packages
sysconfig.get_path('platlib'): /usr/lib/python3.11/site-packages
sysconfig.get_path('include'): /usr/include/python3.11
sysconfig.get_path('scripts'): /usr/bin
sysconfig.get_path('data'): /usr
os.__file__: /usr/lib/python3.11/os.py
threading.__file__: /usr/lib/python3.11/threading.py
debugpy.__file__: /usr/lib/python3.11/site-packages/debugpy/launcher/../../debugpy/__init__.py(/usr/lib/python3.11/site-packages/debugpy/__init__.py)
I+00000.010: sys.argv before parsing: ['/usr/lib/python3.11/site-packages/debugpy/launcher', '51953', '--', '/home/gerion/test/test.py']
I+00000.010: sys.argv after patching: ['/usr/lib/python3.11/site-packages/debugpy/launcher', '/home/gerion/test/test.py']
I+00000.010: Connecting to adapter at 127.0.0.1:51953
D+00000.010: Starting message loop for channel Adapter
D+00000.012: Adapter --> {
"seq": 1,
"type": "request",
"command": "launch",
"arguments": {
"program": "/home/gerion/test/test.py",
"console": "integratedTerminal",
"name": "Launch file",
"request": "launch",
"type": "python",
"pythonArgs": [],
"python": [
"/usr/lib/python-exec/python3.11/python"
],
"processName": "/home/gerion/test/test.py",
"port": 46979,
"adapterAccessToken": "11df718696fb37b9ebf0eba3ba085c46e7a5b399d1d63423c6d8683a1a95c527"
}
}
I+00000.012: /handling #1 request "launch" from Adapter/
Spawning debuggee process:
Command line: ['/usr/lib/python-exec/python3.11/python', '-X', 'frozen_modules=off', '/usr/lib/python3.11/site-packages/debugpy/launcher/../../debugpy', '--connect', '127.0.0.1:46979', '--configure-qt', 'none', '--adapter-access-token', '11df718696fb37b9ebf0eba3ba085c46e7a5b399d1d63423c6d8683a1a95c527', '/home/gerion/test/test.py']
Environment variables: {'JDK_HOME': '/etc/java-config-2/current-system-vm', ...}
I+00000.014: /handling #1 request "launch" from Adapter/
Spawned Debuggee[PID=297316].
D+00000.014: /handling #1 request "launch" from Adapter/
Adapter <-- {
"seq": 1,
"type": "event",
"event": "process",
"body": {
"startMethod": "launch",
"isLocalProcess": true,
"systemProcessId": 297316,
"name": "/home/gerion/test/test.py",
"pointerSize": 64
}
}
D+00000.014: /handling #1 request "launch" from Adapter/
Adapter <-- {
"seq": 2,
"type": "response",
"request_seq": 1,
"success": true,
"command": "launch"
}
I+00000.039: Debuggee[PID=297316] exited with code 1
D+00000.039: Adapter <-- {
"seq": 3,
"type": "event",
"event": "exited",
"body": {
"exitCode": 1
}
}
D+00000.039: Adapter <-- {
"seq": 4,
"type": "event",
"event": "terminated"
}
D+00015.037: Exiting message loop for channel Adapter: No more messages
D+00015.037: Closing Adapter message stream
I+00015.038: Not logging to "<stderr>" anymore.
So, it got the correct arguments but patches(?) it away and then somehow chooses another port.
debugpy.adapter-297301.log
I+00000.011: Linux-6.2.8-gentoo-dist-x86_64-AMD_Ryzen_7_PRO_6850U_with_Radeon_Graphics-with-glibc2.36 x86_64
CPython 3.11.2 (64-bit)
debugpy 1.6.6
I+00000.013: debugpy.adapter startup environment:
System paths:
sys.prefix: /usr
sys.base_prefix: /usr
sys.real_prefix: <missing>
site.getsitepackages(): /usr/lib/python3.11/site-packages
site.getusersitepackages(): /home/gerion/.local/lib/python3.11/site-packages
sys.path (site-packages): /usr/lib/python3.11/site-packages
sysconfig.get_path('stdlib'): /usr/lib/python3.11
sysconfig.get_path('platstdlib'): /usr/lib/python3.11
sysconfig.get_path('purelib'): /usr/lib/python3.11/site-packages
sysconfig.get_path('platlib'): /usr/lib/python3.11/site-packages
sysconfig.get_path('include'): /usr/include/python3.11
sysconfig.get_path('scripts'): /usr/bin
sysconfig.get_path('data'): /usr
os.__file__: /usr/lib/python3.11/os.py
threading.__file__: /usr/lib/python3.11/threading.py
debugpy.__file__: /usr/lib/python3.11/site-packages/debugpy/__init__.py
I+00000.013: Listening for incoming Client connections on 127.0.0.1:59583...
I+00000.014: Connecting to client over stdio...
D+00000.014: Starting message loop for channel Client[1]
D+00000.014: Client[1] <-- {
"seq": 1,
"type": "event",
"event": "output",
"body": {
"category": "telemetry",
"output": "ptvsd",
"data": {
"packageVersion": "1.6.6"
}
}
}
D+00000.014: Client[1] <-- {
"seq": 2,
"type": "event",
"event": "output",
"body": {
"category": "telemetry",
"output": "debugpy",
"data": {
"packageVersion": "1.6.6"
}
}
}
D+00000.014: Client[1] --> {
"seq": 0,
"type": "request",
"command": "initialize",
"arguments": {
"clientname": "neovim",
"adapterID": "nvim-dap",
"pathFormat": "path",
"columnsStartAt1": true,
"linesStartAt1": true,
"supportsRunInTerminalRequest": true,
"supportsVariableType": true,
"supportsProgressReporting": true,
"supportsStartDebuggingRequest": true,
"locale": "de_DE.UTF-8",
"clientId": "neovim"
}
}
D+00000.015: /handling #0 request "initialize" from Client[1]/
Capabilities: {
"supportsVariableType": true,
"supportsVariablePaging": false,
"supportsRunInTerminalRequest": true,
"supportsMemoryReferences": false,
"supportsArgsCanBeInterpretedByShell": false
}
D+00000.015: /handling #0 request "initialize" from Client[1]/
Expectations: {
"locale": "de_DE.UTF-8",
"linesStartAt1": true,
"columnsStartAt1": true,
"pathFormat": "path"
}
D+00000.015: /handling #0 request "initialize" from Client[1]/
Client[1] <-- {
"seq": 3,
"type": "response",
"request_seq": 0,
"success": true,
"command": "initialize",
"body": {
"supportsCompletionsRequest": true,
"supportsConditionalBreakpoints": true,
"supportsConfigurationDoneRequest": true,
"supportsDebuggerProperties": true,
"supportsDelayedStackTraceLoading": true,
"supportsEvaluateForHovers": true,
"supportsExceptionInfoRequest": true,
"supportsExceptionOptions": true,
"supportsFunctionBreakpoints": true,
"supportsHitConditionalBreakpoints": true,
"supportsLogPoints": true,
"supportsModulesRequest": true,
"supportsSetExpression": true,
"supportsSetVariable": true,
"supportsValueFormattingOptions": true,
"supportsTerminateRequest": true,
"supportsGotoTargetsRequest": true,
"supportsClipboardContext": true,
"exceptionBreakpointFilters": [
{
"filter": "raised",
"label": "Raised Exceptions",
"default": false,
"description": "Break whenever any exception is raised."
},
{
"filter": "uncaught",
"label": "Uncaught Exceptions",
"default": true,
"description": "Break when the process is exiting due to unhandled exception."
},
{
"filter": "userUnhandled",
"label": "User Uncaught Exceptions",
"default": false,
"description": "Break when exception escapes into library code."
}
],
"supportsStepInTargetsRequest": true
}
}
D+00000.017: Client[1] --> {
"seq": 1,
"type": "request",
"command": "launch",
"arguments": {
"program": "/home/gerion/test/test.py",
"console": "integratedTerminal",
"name": "Launch file",
"request": "launch",
"type": "python"
}
}
I+00000.017: /handling #1 request "launch" from Client[1]/
Listening for incoming Server connections on 127.0.0.1:46979...
I+00000.018: /handling #1 request "launch" from Client[1]/
Listening for incoming Launcher connections on 127.0.0.1:51953...
I+00000.018: /handling #1 request "launch" from Client[1]/
Session[1] spawning launcher via "runInTerminal" request.
D+00000.018: /handling #1 request "launch" from Client[1]/
Client[1] <-- {
"seq": 4,
"type": "request",
"command": "runInTerminal",
"arguments": {
"kind": "integrated",
"title": "Python Debug Console",
"args": [
"/usr/lib/python-exec/python3.11/python",
"/usr/lib/python3.11/site-packages/debugpy/launcher",
"51953",
"--",
"/home/gerion/test/test.py"
],
"env": {
"DEBUGPY_LOG_DIR": "/home/gerion/test/debugpy"
},
"cwd": "/home/gerion/test"
}
}
D+00000.032: Client[1] --> {
"seq": 2,
"type": "response",
"request_seq": 4,
"success": true,
"command": "runInTerminal",
"body": {
"processId": 297311
}
}
I+00000.069: Accepted incoming Launcher connection from 127.0.0.1:37370.
D+00000.069: Starting message loop for channel Launcher[1]
D+00000.070: /handling #1 request "launch" from Client[1]/
Launcher[1] <-- {
"seq": 1,
"type": "request",
"command": "launch",
"arguments": {
"program": "/home/gerion/test/test.py",
"console": "integratedTerminal",
"name": "Launch file",
"request": "launch",
"type": "python",
"pythonArgs": [],
"python": [
"/usr/lib/python-exec/python3.11/python"
],
"processName": "/home/gerion/test/test.py",
"port": 46979,
"adapterAccessToken": "11df718696fb37b9ebf0eba3ba085c46e7a5b399d1d63423c6d8683a1a95c527"
}
}
D+00000.073: Launcher[1] --> {
"seq": 1,
"type": "event",
"event": "process",
"body": {
"startMethod": "launch",
"isLocalProcess": true,
"systemProcessId": 297316,
"name": "/home/gerion/test/test.py",
"pointerSize": 64
}
}
D+00000.073: Launcher[1] --> {
"seq": 2,
"type": "response",
"request_seq": 1,
"success": true,
"command": "launch"
}
D+00000.074: /handling #1 event "process" from Launcher[1]/
Propagation deferred.
I+00000.074: /handling #1 request "launch" from Client[1]/
Session[1] waiting for connection from debug server...
D+00000.098: Launcher[1] --> {
"seq": 3,
"type": "event",
"event": "exited",
"body": {
"exitCode": 1
}
}
D+00000.098: Launcher[1] --> {
"seq": 4,
"type": "event",
"event": "terminated"
}
I+00015.074: All debug servers disconnected; waiting for remaining sessions...
E+00015.088: /handling #1 request "launch" from Client[1]/
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/debugpy/common/messaging.py", line 1015, in __init__
raise self
debugpy.common.messaging.MessageHandlingError: Timed out waiting for debuggee to spawn
Stack where logged:
File "/usr/lib/python3.11/threading.py", line 995, in _bootstrap
self._bootstrap_inner()
File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/usr/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.11/site-packages/debugpy/common/messaging.py", line 1458, in _run_handlers
handler()
File "/usr/lib/python3.11/site-packages/debugpy/common/messaging.py", line 701, in _handle
result = handler(self)
File "/usr/lib/python3.11/site-packages/debugpy/adapter/components.py", line 91, in lock_and_handle
return f(self, message)
File "/usr/lib/python3.11/site-packages/debugpy/adapter/clients.py", line 213, in handle
f(self, request)
File "/usr/lib/python3.11/site-packages/debugpy/adapter/clients.py", line 408, in launch_request
launchers.spawn_debuggee(
File "/usr/lib/python3.11/site-packages/debugpy/adapter/launchers.py", line 187, in spawn_debuggee
raise start_request.cant_handle("Timed out waiting for debuggee to spawn")
File "/usr/lib/python3.11/site-packages/debugpy/common/messaging.py", line 525, in cant_handle
return self.error(MessageHandlingError, *args, **kwargs)
File "/usr/lib/python3.11/site-packages/debugpy/common/messaging.py", line 513, in error
exc = exc_type(reason, self, silent) # will log it
File "/usr/lib/python3.11/site-packages/debugpy/common/messaging.py", line 1017, in __init__
log.swallow_exception()
File "/usr/lib/python3.11/site-packages/debugpy/common/log.py", line 215, in swallow_exception
_exception(format_string, *args, **kwargs)
D+00015.088: /handling #1 request "launch" from Client[1]/
Client[1] <-- {
"seq": 5,
"type": "response",
"request_seq": 1,
"success": false,
"command": "launch",
"message": "Timed out waiting for debuggee to spawn"
}
D+00015.094: Exiting message loop for channel Client[1]: No more messages
D+00015.094: Closing Client[1] message stream
E+00015.095: /handling #1 request "launch" from Client[1]/
Handler 'Client._start_message_handler.<locals>.handle' (file '/usr/lib/python3.11/site-packages/debugpy/adapter/components.py', line 197)
couldn't handle #1 request "launch" from Client[1]:
Timed out waiting for debuggee to spawn
D+00015.095: /handling #4 event "terminated" from Launcher[1]/
Closing Launcher[1] message stream
I+00015.095: /handling disconnect from Client[1]/
Client[1] has disconnected; finalizing Session[1].
I+00015.095: /handling disconnect from Client[1]/
Session[1] waiting for Launcher[1] to disconnect...
D+00015.095: Exiting message loop for channel Launcher[1]: No more messages
I+00015.096: /handling disconnect from Launcher[1]/
Session[1] has ended.
I+00015.096: All debug sessions have ended; exiting.
I+00015.096: /handling disconnect from Client[1]/
Session[1] finalized.
I+00015.096: Not logging to "<stderr>" anymore.
this looks like an error I encountered, too. There is some stuff in my debugpy.launcher.log:
I+00000.031: /handling #1 request "launch" from Adapter/
Failed to set up process group
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/debugpy/launcher/../../debugpy/launcher/debuggee.py", line 74, in preexec_fn
tty = os.open("/dev/tty", os.O_RDWR)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 6] No such device or address: '/dev/tty'
Stack where logged:
File "/usr/lib/python3.11/threading.py", line 995, in _bootstrap
self._bootstrap_inner()
File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/usr/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.11/site-packages/debugpy/launcher/../../debugpy/common/messaging.py", line 1458, in _run_handlers
handler()
File "/usr/lib/python3.11/site-packages/debugpy/launcher/../../debugpy/common/messaging.py", line 701, in _handle
result = handler(self)
File "/usr/lib/python3.11/site-packages/debugpy/launcher/../../debugpy/launcher/handlers.py", line 140, in launch_request
debuggee.spawn(process_name, cmdline, env, redirect_output)
File "/usr/lib/python3.11/site-packages/debugpy/launcher/../../debugpy/launcher/debuggee.py", line 91, in spawn
process = subprocess.Popen(cmdline, env=env, bufsize=0, **kwargs)
File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.11/subprocess.py", line 1850, in _execute_child
self.pid = _fork_exec(
File "/usr/lib/python3.11/site-packages/debugpy/launcher/../../debugpy/launcher/debuggee.py", line 83, in preexec_fn
log.swallow_exception(
File "/usr/lib/python3.11/site-packages/debugpy/launcher/../../debugpy/common/log.py", line 215, in swallow_exception
_exception(format_string, *args, **kwargs)
whole log is attached. debugpy.launcher-4150.log
I have the same problem too. Waiting for a solution.
Same issue here.
In my case the issue was with an obsolete library enum34
D+00000.240: Launcher[1] --> {
"seq": 6,
"type": "event",
"event": "output",
"body": {
"category": "stderr",
"output": " class RegexFlag(enum.IntFlag):\nAttributeError: module 'enum' has no attribute 'IntFlag'\n"
}
}
The fix was just to remove it with:
pip uninstall -y enum34
The advice to turn on DEBUGPY_LOG_DIR
was very helpful. Thanks.