vscode-python: Docker launch config not running after last update

This issue has been confired by multiple users on microsoft/vscode github. @roblourens told me to move the issue here.

  • VS Code Version: Version: 1.75.0
  • Python extension: v2023.2.0
  • OS Version: Mac OS Ventura 13.1 (22C65)

After Update of Python extension to v2023.2.0, when using configuration defined in launch.json with Docker - e.g. "name": "Docker: Python gunicorn", I get an popup error

Invalid message: "pythonPath" is not valid if "python" is specified

I cannot locate this error in any OUTPUT window.

I’m pretty sure, that everything worked before the update, because I committed those files to git yesterday. When this stopped working I checked them out to see if maybe I made a mistake somewhere, but no.

This doesn’t happen when I run the .py file locally, nor when I build and run container manually.

I’ve downgraded to 1.74.3 and it’s all fine.

Reinstallation of vscode and deleting .vscode folder doesn’t help either.

launch.json

{
    "version": "2.0.0",
    "configurations": [
        {
            "name": "Local Python: flask",
            "type": "python",
            "request": "launch",
            "module": "flask", 
            "env": {
                "FLASK_RUN_PORT": "8082"
            },
            "args": [
                "--app",
                "app:server",
                "--debug",
                "run"
            ],
            "justMyCode": true
        },
        {
            "name": "Docker: Python flask",
            "type": "docker",
            "request": "launch",
            "preLaunchTask": "docker-run: debug flask",
            "python": {
                "pathMappings": [
                    {
                        "localRoot": "${workspaceFolder}",
                        "remoteRoot": "/app"
                    }
                ],
                "projectType": "flask"
            }
        },
        {
            "name": "Docker: Python gunicorn",
            "type": "docker",
            "request": "launch",
            "preLaunchTask": "docker-run: debug gunicorn",
            "python": {
                "pathMappings": [
                    {
                        "localRoot": "${workspaceFolder}",
                        "remoteRoot": "/app"
                    }
                ],
                "projectType": "general"
            }
        }
    ]
}

tasks.json

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "docker-build",
			"label": "docker-build",
			"platform": "python",
			"dockerBuild": {
				"tag": "tuzdashapp:latest",
				"dockerfile": "${workspaceFolder}/Dockerfile",
				"context": "${workspaceFolder}",
				"pull": true
			}
		},
		{
			"type": "docker-run",
			"label": "docker-run: debug flask",
			"dependsOn": [
				"docker-build"
			],
			"dockerRun": {
				"env": {
					"FLASK_APP": "app.py",
					"FLASK_DEBUG": "1"
				},
				"volumes": [
					{
					  "containerPath": "/app", "localPath": "${workspaceFolder}"
					}
				  ],
				"ports": [
					{ "hostPort": 8082, "containerPort": 8082 }
				  ]
			},
			"python": {
				"args": [
					"run",
					"--no-debugger",
					// "--no-reload",
					"--host", "0.0.0.0",
					"--port", "8082"
				],
				"module": "flask"
			}
		},
		{
			"type": "docker-run",
			"label": "docker-run: debug gunicorn",
			"dependsOn": [
				"docker-build"
			],
			"dockerRun": {
				"volumes": [
					{
					  "containerPath": "/app", "localPath": "${workspaceFolder}"
					}
				  ],
				  "ports": [
					{ "hostPort": 8082, "containerPort": 8082 }
				  ]
			},
			"python": {
				"args": [
					"--timeout", "240",
					"--reload",
					"--bind", "0.0.0.0:8082",
					"app:server"
				],
				"module": "gunicorn"
			}
		}
	]
}

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 17
  • Comments: 17 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Try pre-release python extension version 2023.5.10602345 or greater.

Same issue, every update to VSCode / Python extension breaks my workflow. I am currently using Code 1.74.3 with Python v2022.18.2 and everything works fine. Every other newer version has something broken.

There’s no other workaround other than downgrading?

I’m also disappointed to see this. Almost a month after the issue was reported, the only workaround we have is to downgrade.

It brings down my confidence in this VSCode extension.

There’s no other workaround other than downgrading?

@int19h thank you SO MUCH! Yes, the ‘clientOS’ entry referenced in #20407 was the last missing piece for me. I am on Windows but using WSL.

@cdena-accelins This sounds like #20407, which is a serparate issue - can you check if the “clientOS” workaround described there works for you?

@nil-is-lin You can disable upgrade from the settings. Looks for User settings > Application > Update

I think:

Invalid message: "pythonPath" is not valid if "python" is specified

popup is coming from debugpy. Any ideas @int19h ?

Reassigning as it’s debugger related. @paulacamargo25 Please make sure we’re sending the right configuration to debugpy and it does not contain pythonPath, after which we can transfer this to debugpy.