ptvsd is a remote debugging server for Python, primarily used to enable debugging capabilities in development environments like Visual Studio and Visual Studio Code. While its last stable release was 4.3.2 in August 2019, it has largely been superseded by `debugpy`, which is based on ptvsd's development branch. All future development for Microsoft's Python debugger is happening in `debugpy`.
pip install ptvsdVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize ptvsd for remote debugging within a Python script. It sets up a listening server that a debugger (e.g., Visual Studio Code) can connect to. It uses environment variables for configuration for better portability and includes an optional `wait_for_attach()` call to pause execution until the debugger connects. A `breakpoint()` call is included to show how to trigger a debugger pause during execution.
Migrate your debugger configuration and code to use `debugpy`. For Visual Studio Code and Visual Studio 2019 (v16.5+), the transition to `debugpy` should be automatic with up-to-date extensions. For manual usage, replace `import ptvsd` with `import debugpy` and adjust API calls accordingly (e.g., `debugpy.listen` instead of `ptvsd.enable_attach`).
Upgrade Visual Studio to version 2019 (v16.5+) or later to automatically use `debugpy`. If using an older VS version, ensure `ptvsd` in your Python environment matches the version expected by your Visual Studio installation, or enable the 'legacy debugger' option in Visual Studio's Python debugging settings.
Add `import multiprocessing; multiprocessing.set_start_method('spawn', True)` at the very beginning of your main script, before any other multiprocessing-related code. This ensures consistent behavior across platforms.Ensure `ptvsd` is installed in your target Python environment using `pip install ptvsd`. Verify that your IDE (e.g., VS Code) is configured to use the correct Python interpreter where `ptvsd` is installed.
1. **Check versions:** Ensure `ptvsd` (or preferably `debugpy`) is up-to-date and compatible with your IDE. 2. **Verify host/port:** Double-check that the `address` parameter in `ptvsd.enable_attach()` matches the host and port specified in your debugger's attach configuration. 3. **Firewall:** Confirm that no firewall is blocking the specified port on either the client or server side. 4. **Path Mappings:** In your `launch.json` or equivalent debugger configuration, ensure `localRoot` and `remoteRoot` correctly map your local project paths to the remote execution paths. Also, check `justMyCode` setting.
Ensure you are using the latest stable `ptvsd` (4.3.2) or, preferably, migrate to `debugpy`. If the issue persists, try isolating the environment to see if other packages cause conflicts. Check the GitHub issues for `ptvsd` or `debugpy` for specific version-related workarounds.
No dependency data recorded yet.