Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

timed out waiting for debugger to spawn #1982

Closed
jarlva opened this issue Dec 12, 2019 · 19 comments
Closed

timed out waiting for debugger to spawn #1982

jarlva opened this issue Dec 12, 2019 · 19 comments
Labels

Comments

@jarlva
Copy link

jarlva commented Dec 12, 2019

Getting the error above as a pop up after trying to debug a python file. Using the latest python extension.
Reverted to a version a month old, 2019.11.50794 (22 November 2019), and the problem is gone.

@brettcannon brettcannon transferred this issue from microsoft/vscode-python Dec 12, 2019
@int19h int19h added the Bug label Dec 13, 2019
@int19h
Copy link
Contributor

int19h commented Dec 13, 2019

Could you please provide some more information about the scenario? Especially the debug config in launch.json, and the command line that shows up in the terminal when you start.

@jarlva
Copy link
Author

jarlva commented Dec 14, 2019

Here it is:
sb) C:\Users\userX\py\test>cmd /C "set "PTVSD_SESSION_ID=1" && set "PTVSD_LAUNCHER_PORT=51886" && c:\Users\userX\py\sb\Scripts\python.exe c:\Users\userX.vscode\extensions\ms-python.python-2019.10.44104\pythonFiles\lib\python\ptvsd-cp37-cp37m-win_amd64\ptvsd\launcher c:\Users\userX\py\test\train.py "

launch.json:

{
// 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: Current File (Integrated Terminal)",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "integratedTerminal"
    },
    {
        "name": "Python: Remote Attach",
        "type": "python",
        "request": "attach",
        "port": 5678,
        "host": "localhost",
        "pathMappings": [
            {
                "localRoot": "${workspaceFolder}",
                "remoteRoot": "."
            }
        ]
    },
    {
        "name": "Python: Module",
        "type": "python",
        "request": "launch",
        "module": "enter-your-module-name-here",
        "console": "integratedTerminal"
    },
    {
        "name": "Python: Django",
        "type": "python",
        "request": "launch",
        "program": "${workspaceFolder}/manage.py",
        "console": "integratedTerminal",
        "args": [
            "runserver",
            "--noreload",
            "--nothreading"
        ],
        "django": true
    },
    {
        "name": "Python: Flask",
        "type": "python",
        "request": "launch",
        "module": "flask",
        "env": {
            "FLASK_APP": "app.py"
        },
        "args": [
            "run",
            "--no-debugger",
            "--no-reload"
        ],
        "jinja": true
    },
    {
        "name": "Python: Current File (External Terminal)",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "externalTerminal"
    }
]

}

@int19h
Copy link
Contributor

int19h commented Dec 14, 2019

Thanks! One more thing I forgot:

import ptvsd; print(ptvsd.__version__)

and I notice that path to python.exe doesn't look like it's for a globally installed interpreter - is that a virtual environment?

@TylerGubala
Copy link

I am having the same issue:

image

Here's my Launch.json:

{
    // 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: Module",
            "type": "python",
            "request": "launch",
            "module": "ghostarms"
        }
    ]
}

@int19h
Copy link
Contributor

int19h commented Dec 15, 2019

@TylerGubala Can you also provide ptvsd.__version__, and whether you're trying to run using a virtual environment?

@jarlva
Copy link
Author

jarlva commented Dec 18, 2019

Running Windows 10 (no virtual env). Python is set to a venv.
Not sure how to get the ptvsd.version . I have two VS 2017, 2019. In C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\Microsoft\Python\Core\ptvsd_init_.py I see: version = "3.2.1.0"

@mzuzek
Copy link

mzuzek commented Dec 18, 2019

Got the same issue ("Session-1 timed out waiting for debuggee to spawn") on Win10, VS Code 1.41.0, Python extension 2019.11.50794 and ptvsd 5.0.0a7.

It happens here only in virtual environment (py -3 -m venv .venv) - I get debugger working fine the regular way.

@int19h
Copy link
Contributor

int19h commented Dec 18, 2019

To get __version__, the most reliable method is to do this inside the app being debugged:

import ptvsd
print(ptvsd.__version__)

But if you're hitting this when debugging a virtual environment, it's the same as #1930. We already have a fix for that - you can install the insider's build of the extension to get a version of ptvsd with the fix:

https://pvsc.blob.core.windows.net/extension-builds/ms-python-insiders.vsix

If you'd rather stay on stable version, then you can opt out of the pre-release debugger by unchecking Python > Experiments: Enabled in VSCode settings.

@jarlva
Copy link
Author

jarlva commented Dec 19, 2019

Thanks for the info!
I'll wait for the next stable version.

@jarlva jarlva closed this as completed Dec 19, 2019
@RajeshSivadasan
Copy link

I am also facing the same issue.
VSCode Details:

Version: 1.41.1 (system setup)
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T14:58:56.166Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.16299

Python Extension

Version: 2020.2.64397

launch.json

{
// 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: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Python: Current File (Console)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "internalConsole",
"justMyCode": false
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Launch Current File",
"script": "${file}",
"args": [],
"cwd": "${file}"
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Launch Current File in Temporary Console",
"script": "${file}",
"args": [],
"cwd": "${file}",
"createTemporaryIntegratedConsole": true
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Launch Current File w/Args Prompt",
"script": "${file}",
"args": [
"${command:SpecifyScriptArgs}"
],
"cwd": "${file}"
},
{
"type": "PowerShell",
"request": "attach",
"name": "PowerShell Attach to Host Process",
"processId": "${command:PickPSHostProcess}",
"runspaceId": 1
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Interactive Session",
"cwd": ""
}
]
}

@int19h
Copy link
Contributor

int19h commented Apr 8, 2020

@RajeshSivadasan, can you try a more recent version of the extension (and perhaps VSCode as well)?

@hecsanper
Copy link

I have the same issue, I also get the message "Session -1 timed out waiting for debuggee to spawn", but not on Visual Studio Code, I use Visual Studio 2019. As the provided solutions all seem to be specific to Visual Studio Code, how can I solve it in Visual Studio 2019?

@int19h
Copy link
Contributor

int19h commented Apr 16, 2020

@huguesv Is there any specific trick to ensuring that VS runs a version of debugpy with the fix?

@huguesv
Copy link
Contributor

huguesv commented Apr 16, 2020

they're mostly non interchangeable now:

VS 2019 16.4 and earlier only works with ptvsd 4.x
VS 2019 16.5 only works with debugpy 1.0 beta 1
VS 2019 16.6 preview 3 only works with debugpy 1.0 beta 4 or later (it ships with beta 5)

@hecsanper
Copy link

Are you saying there is no solution?

@int19h
Copy link
Contributor

int19h commented Apr 16, 2020

@hecsanper If you're hitting the same bug, then it should be fixed in debugpy. So updating VS to 16.5 should take care of it.

If you're still seeing the error message after upgrading, please file a separate issue for it, with more information (Python version, virtual environment or not, launch.json config, repro steps, and ideally also logs from "logToFile": true).

@RajeshSivadasan
Copy link

@RajeshSivadasan, can you try a more recent version of the extension (and perhaps VSCode as well)?

@int19h Sorry for the late reply. I believe this is the latest version of both extension and VS code. Let me know if I am missing anything. Thanks!

@int19h
Copy link
Contributor

int19h commented Apr 17, 2020

@RajeshSivadasan 2020.2 is a version of the extension from February, with correspondingly old debugger - it should be 2020.3 if you're running the most recent stable. But we're iterating on the debugger quickly to ensure that we can go all in on debugpy, so it's best to run the insiders version of the extension to get the most recent fixes. #2104 explains how to enable that.

If you still see the problem with those versions, please file a separate issue on https://github.com/microsoft/debugpy - even if the error message is the same, the underlying problem is different, so we need to track the investigation and the fix separately.

@hecsanper
Copy link

I already have that version. I more or less solved the problem by running without debugging, but I can't debug now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants