Visual Studio does not use current PTVSD version



I use Visual Studio 2017 (V15.8.9) with python tools. When I try to remote debug using ptvsd I see different versions depending where I import ptvsd.

When opening a python console in visual studio in my current environment and import ptvsd, i allways get version which is installed in %ProgramFiles(x86)%microsoft visual studio2017communitycommon7ideextensionsmicrosoftpythoncoreptvsd.

If I install ptvsd in the python environment, the current version 4.2.0 is correctly installed. But when I repeat the above import statement I still see Version The packet version installed in the core seems to override the newer package installed in the environment.

On the remote machine the current version of PTVSD is installed and used. This leads to a version mismatch.


When using PTVSD 3.2.1 on both machines, visual studio complains when starting the debug that there would be a newer version (4.1.1a9) installed on the local machine.


  • What do I need to use the current version of PTVSD?
  • Is downgrading the only option?
Asked By: Georg W.



I’ve been fighting with apparent problems with outdated PTVSD in VS2017 for weeks now. I’ve frequently tried updated Visual Studio itself (currently 15.9.9) but still got random crashes, usually involving KeyError: 'matplotlib.pyplot, and other hangs and failures to hit breakpoints until I found:

I used these steps to upgrade ptvsd from V3.2.1 to V4.2.4, after which my Python debugging problems have thus far gone away:

  1. Navigate to the Packages tab in the Python Environments window.
  2. Select the Python environment used for your project (this isn’t apparent from the instructions).
  3. Enter ptvsd --upgrade in the search box, then select Run command: pip install ptvsd --upgrade. (You can also use the same command from PowerShell.)
Answered By: Jay Borseth

Long story short

Utilize legacy debugger. This was the only option which worked for me in conjunction with Python 3.4 and Microsoft Visual Studio 2017 and 2019. Sadly, Microsoft droped support for the ptvsd debugger completely with Visual Studio 2022.

To enable the legacy debugger, go to Debug -> Options... -> Python -> Debugging and check Use legacy debugger. In both VS2017 and VS2019, the legacy debugger is based on ptvsd (with some auxiliary scripts referring to 3.1 and 3.2). You need to import that one in your Python project before attaching to a running Python process.


Visual Studio 2017

It appears from Microsoft’s documentation (see and source code of the debugger shipped with Visual Studio 2017 that the Python debugger built into Visual Studio 2017 was based on ptvsd 4.1.1a9 debugger. In my distribution of VS2017 (Professional Edition), the latest Python debugger utilized in Visual Studio 2017 is in fact located at %ProgramFiles(x86)%microsoft visual studio2017Professionalcommon7ideextensionsmicrosoftpythoncorePackagesptvsd, (see However, attempts to use ptvsd 4.1.1a9, 4.1.1 or more up-to-date versions like 4.3.2 result in either failures to connect to the Python process to be debugged, or in frequent freezes of Visual Studio. I would name such debugger support highly experimental.

Visual Studio 2019

Starting with Visual Studio 2019, Microsoft apparently dropped support for then up-to-date releases of ptvsd in favour of debugpy which they picked as the default Python debugger. In some cases (Python 3.4, for example, for which debugpy was never available), the only option there is to drop to the legacy debugger. The legacy debugger stayed the same as in Visual Studio 2017, i.e. ptvsd

The legacy debugger (ptvsd)

You are indeed right that the legacy version of ptvsd built into Visual Studio is stored at %ProgramFiles(x86)%microsoft visual studio2017communitycommon7ideextensionsmicrosoftpythoncoreptvsd (replace 2017 with 2019 for VS2019 and Professional with your edition of the VS). This package is automatically imported in any Python Interactive Window when importing ptvsd, no matter which version is installed in the target Python environment – I suppose this is a bug.

Answered By: Kyselejsyre─Źek