GoogleCloudPlatform / cloud-code-vscode

Cloud Code for Visual Studio Code: Issues, Documentation and more
Other
420 stars 112 forks source link

Can't attach to python container (kubernetes) - "Python is required to debug the Python application" #833

Open mdryden opened 1 year ago

mdryden commented 1 year ago

Type: Bug

Context

Create a debuggable python container (3.10) and launch with skaffold debug command.

Using the following launch configuration, attempt to attach and debug the pod:

        {
            "name": "Core - Attach",
            "type": "cloudcode.kubernetes",
            "request": "attach",
            "language": "Python",
            "debugPort": 5678,
            "podSelector": {
                "app": "core"
            },
            "localRoot": "${workspaceFolder}/app",
            "remoteRoot": "/app",
        },

Extension version: 1.22.0 VS Code version: Code 1.80.1 (74f6148eb9ea00507ec113ec51c489d6ffb4b771, 2023-07-12T17:22:07.651Z) OS version: Windows_NT x64 10.0.22621 Modes: Remote OS version: Linux x64 5.15.90.1-microsoft-standard-WSL2

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 7 PRO 4750U with Radeon Graphics (16 x 1697)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|37.73GB (10.22GB free)| |Process Argv|--folder-uri=vscode-remote://wsl+Ubuntu/home/mike/src/python-fastapi-framework --remote=wsl+Ubuntu --crash-reporter-id e72eff0d-cd49-49f5-b883-24b015e37721| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 5.15.90.1-microsoft-standard-WSL2| |CPUs|AMD Ryzen 7 PRO 4750U with Radeon Graphics (16 x 1696)| |Memory (System)|18.41GB (9.70GB free)| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 vserr242:30382549 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 vscorecescf:30445987 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 pythonvs932:30410667 vscaac:30438847 vsclangdf:30486550 c4g48928:30535728 dsvsc012cf:30540253 pynewext54:30695312 azure-dev_surveyone:30548225 vsccc:30610678 2e4cg342:30602488 f6dab269:30613381 showlangstatbar:30737416 vsctsb:30748421 03d35959:30757346 pythonfmttext:30731395 pythoncmvfstrcf:30756944 fixshowwlkth:30771522 hideindicator:30785051 pythongtdpath:30769146 i26e3531:30792625 pythonnosmt12:30779714 pythonidxpt:30784022 pythonnoceb:30776495 e537b577:30795824 dsvsc013:30795093 ```

I receive the following error in vscode when attempting to launch the task:

image

My suspicion here is that Cloud Code is attempt to launch the debugger using "python" as the command, but as I'm using Ubuntu 22.04 (in WSL2), "python" does not exist. (It would be "python3", or preferably, my activated virtual environment). I'm using a virtual environment for this project, which is activated in vscode, and I suspect that the extension is not able to detect that.

There's no obvious attribute I can see in the configuration to set the interpreter so I'm not sure how to resolve this issue.

mdryden commented 1 year ago

Another potentially relevant bit of information is that I'm using a multi-root workspace, and the virtual environment is not at the root of the workspace.

Edit: to rule this out I ran skaffold debug in an external terminal window, opened just the project and question and tried to debug, but I still get the same error.

mdryden commented 1 year ago

I also tried temporarily adding this to my settings.json file:

"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",

No change in behavior.

davidponder commented 1 year ago

Hello @mdryden !

Thanks for the additional information here. I'll bounce this over to the team so we can take a look.

khaerensml6 commented 1 year ago

+1, having the same issue