Vscode-docker: Python debug fails with "Unable to find the debugger in the Python extension"

Created on 18 Jun 2020  Â·  13Comments  Â·  Source: microsoft/vscode-docker

image

Python Debug external tracking

Most helpful comment

I have Docker extension v 1.3.1 and I'm still seeing this.

Version: 1.46.1
Commit: cd9ea6488829f560dc949a8b2fb789f3cdc05f5d
Date: 2020-06-17T21:17:14.222Z (2 days ago)
Electron: 7.3.1
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.3.0

    > Executing task: docker-run: debug <
    Unable to find the debugger in the Python extension.
    The terminal process failed to launch (exit code: 1)
    Terminal will be reused by tasks, press any key to close it.

launch.json

{
    "version": "0.2.0",
    "logToFile": true,
    "configurations": [
        {

            "name": "Docker: Python - General",
            "type": "docker",
            "request": "launch",
            "preLaunchTask": "docker-run: debug",
            "python": {
                "pathMappings": [
                    {
                        "localRoot": "${workspaceFolder}",
                        "remoteRoot": "/code"
                    }
                ],
                "projectType": "general"
            }
        }
    ]
}

All 13 comments

A fix for this is now released in Docker extension version 1.3.1.

I have Docker extension v 1.3.1 and I'm still seeing this.

Version: 1.46.1
Commit: cd9ea6488829f560dc949a8b2fb789f3cdc05f5d
Date: 2020-06-17T21:17:14.222Z (2 days ago)
Electron: 7.3.1
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.3.0

    > Executing task: docker-run: debug <
    Unable to find the debugger in the Python extension.
    The terminal process failed to launch (exit code: 1)
    Terminal will be reused by tasks, press any key to close it.

launch.json

{
    "version": "0.2.0",
    "logToFile": true,
    "configurations": [
        {

            "name": "Docker: Python - General",
            "type": "docker",
            "request": "launch",
            "preLaunchTask": "docker-run: debug",
            "python": {
                "pathMappings": [
                    {
                        "localRoot": "${workspaceFolder}",
                        "remoteRoot": "/code"
                    }
                ],
                "projectType": "general"
            }
        }
    ]
}

I'm not too familiar with vscode but here is a bit more context on what i see locally:

It looks like the code in launcher.py in the commit to fix the bug is applied.

When I grep for "Unable to find the debugger" in .vscode, I get

/.vscode//extensions/ms-azuretools.vscode-docker-1.3.1/dist/extension.bundle.js

<snip>
||void 0===e?void 0:e.debug)||void 0===n?void 0:n.getDebuggerPackagePath());if(s)return s;throw new Error(a.localize("vscode-docker.tasks.pythonExt.noDebugger",
"Unable to find the debugger in the Python extension."))} ,e.getPythonExtension=getPythonExtension}(n.PythonExtensionHelper||(n.PythonExtensionHelper={}))},function(e,n,i){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.nodeDebugHelper=n.NodeDebugHelper=void 0;const s=i(367),o=i(368),a=i(193);class NodeDebugHelper{async provideDebugConfigurations(e){return[{name:"Docker Node.js Launch",type:"docker",request:"launch",preLaunchTask:"docker-run: debug",platform:"node"}]}async resolveDebugConfiguration(e,n){const i=n.node||{},l=s.NodeTaskHelper.inferPackagePath(i.package,e.folder),u=await o.readPackage(l),c=await o.inferPackageName(u,l),p=a.inferContainerName(n,e,c),d={containerName:p,dockerServerReadyAction:a.resolveDockerServerReadyAction(n,{containerName:p},!0),removeContainerAfterDebug:n.removeContainerAfterDebug},m={...i,name:n.name,dockerOptions:d,preLaunchTask:n.preLaunchTask,request:"attach",type:"node2"};return void 0===m.localRoot&&(m.localRoot="${workspaceFolder}"),void 0===m.port&&
<snip>

The commit appeared to have removed that in the .ts file. Perhaps the new build of the js bundle isn't getting forced in the update?

@kbroughton @EduardBlinov @Mikecom32 What version of the Python extension do you have?

EDIT: I see @Mikecom32 tried both 2020.6.88468 and 2020.6.89148, both of which ought to be working.

@luabud Is there a way for users to opt-out of the new debugpy debugger (or, have never gotten in)? In both those versions of the Python extension the only way that we should be getting undefined from the Python extension is if it determines it is not opted in to DebugAdapterNewPtvsd.experiment.

The issue was in the Python extension, it's the same root cause of https://github.com/microsoft/vscode-python/issues/12481. Update: it should be fixed now.

It looks like this might also be what @ddurham2 is hitting in https://github.com/microsoft/vscode-python/issues/12484

The extension says v2020.6.89148 @bwateratmsft

Thanks @kbroughton. I think that it should be fixed now from the Python extension side (without needing to upgrade). I tried it out and I can no longer reproduce the issue. Can you give it a try? I'm not sure how the experimentation framework is implemented in the Python extension--perhaps @luabud can answer that--but it might take a bit of time to download the new experiment data before it starts working again.

nether docker nor python extensions show an update available for VS code. How do I try it out? @bwateratmsft

@kbroughton the fix in the Python extension shouldn't require an update since it is already pulling the information about the experiments from the server, restarting VS Code didn't help?

You can try add those settings as mentioned by Pavel here:

    "python.experiments.optInto": [
        "DebugAdapterFactory - experiment",
        "PtvsdWheels37 - experiment"
    ],

I did restart VSCode, but get the same error.
Here is 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",
"logToFile": true,
"configurations": [

{
"name": "Docker: Python - General",
"type": "docker",
"request": "launch",
"preLaunchTask": "docker-run: debug",
"python": {
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/code"
}
],
"projectType": "general"
}
}
],
"python.experiments.optInto": [
"DebugAdapterFactory - experiment",
"PtvsdWheels37 - experiment"
]
}

On Mon, Jun 22, 2020 at 4:55 PM Hani Amr notifications@github.com wrote:

@kbroughton https://github.com/kbroughton the fix in the Python
extension shouldn't require an update since it is already pulling the
information about the experiments from the server, restarting VS Code
didn't help?

You can try add those settings as mentioned by Pavel here
https://github.com/microsoft/vscode-python/issues/12481#issuecomment-647266379
:

"python.experiments.optInto": [
    "DebugAdapterFactory - experiment",
    "PtvsdWheels37 - experiment"
],

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/microsoft/vscode-docker/issues/2080#issuecomment-647788957,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACQSXMQ7OKS75IR7L64A7LLRX7HOFANCNFSM4OBVI4ZA
.

That python.experiments.optInto section needs to go into your settings.json, not launch.json.

I'll close this issue again since it appears to be fixed on the Python extension side.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wsmelton picture wsmelton  Â·  4Comments

oberfoerster picture oberfoerster  Â·  6Comments

thernstig picture thernstig  Â·  3Comments

Justpro77 picture Justpro77  Â·  3Comments

Szauka picture Szauka  Â·  6Comments