So it turns out it's pretty easy: replace the "port" and "host" attributes with "connect", so if your configuration was:
{
"type": "python",
"request": "attach",
"name": "attach remote",
"host": "192.168.1.101",
"port": 8765,
"pathMappings": [
{
"localRoot": "${workspaceFolder}/...",
"remoteRoot": "/usr/app/..."
}
],
"justMyCode": false
},
It becomes:
{
"type": "debugpy",
"request": "attach",
"name": "attach remote",
"connect": { "host": "192.168.1.101", "port": 8765 },
"pathMappings": [
{
"localRoot": "${workspaceFolder}/...",
"remoteRoot": "/usr/app/..."
}
],
"justMyCode": false
},
Answer from PeterKogan on Stack Overflow
» pip install debugpy
Videos
Did you add a breakpoint?
debugpy.breakpoint()
import debugpy
# 5678 is the default attach port in the VS Code debug configurations. Unless a host and port are specified, host defaults to 127.0.0.1
debugpy.listen(5678)
print("Waiting for debugger attach")
debugpy.wait_for_client()
debugpy.breakpoint() #must have
print('break on this line')
Ref: https://code.visualstudio.com/docs/python/debugging
You can put a breakpoint in the Python source file before attach to the debugpy server, then it will hit and break back into VSCode after attach.
Turns out I needed to download a Python debugger in the VSCode extensions. I used Python Debugger from Microsoft.

For someone who keep trying uninstall, reinstall Extensions like "Python", "Python Debugger" and still ran into this error.
I accidentally upgrade my vscode and met this error, I was trying to add a debug configuration by using IDE select: Run > Add Configuration > Select Python Debugger at the autocomplete selection.
And it pops out the new debugging configuration that I could run debugger, and the difference between new one and mine is the "type" argument
// New configuration
{
"type": "debugpy",
}
// Mine configuration
{
"type": "python",
}
So I update my old configuration type to debugpy and debugger is running.
» pip install debugpy-run