PlatformIO installation stuck at `Downloading portable Python interpreter` in vscode

Hi,
I am trying to reinstall PlatformIO in VS Code after it failed to import any project from Arduino IDE it was just stuck on “Please wait” for hours.
Now reinstalling is stuck on “PlatformIO Installer: Downloading portable Python interpreter”
In runtime status, it is showing 40 errors like “connect ECONNREFUSED 127.0.0.1:8047”

I tried completely removing VS Code, python and all folders associated with it including .platformio and .vscode, tried completely disabling the firewall and do not have any antivirus installed. Only Windows Defender is active.
Still, it is stuck at the same point.

Please help.

Below is the screenshot of debug console:

Is another program using port 8047? In the extension settings for PlatformIO you should be able to change the “PIO Home port” to a maybe a free port a few numbers above.

I had this today. I closed PlatformIO, went to C:\Users\gordo.platformio.cache\tmp and deleted the most recent file (python-portable-windows_amd64-1.30910.0.tar.gz) which was only 4MB. Once I restarted PlatformIO, the installation process resumed and this file got re-downloaded (it ended up 21MB). Everything was successful - I guess the error handling isn’t great.