Skip to content

Error "No module named ptvsd.__main__" with ptvsd version greater than 4.1.1 #2698

Description

@MandarJKulkarni

Environment data

Environment data
VS Code version: 1.27.2
Extension version (available under the Extensions sidebar): 2018.8.0
OS and version: Windows 10
Python version (& distribution if applicable, e.g. Anaconda): 2.7
Type of virtual environment used : N/A

Actual behavior

After upgrading ptvsd to 4.1.2 or 4.1.3, getting below error when I try to debug any Python file.
C:\Python27\python.exe: No module named ptvsd.main; 'ptvsd' is a package and cannot be directly executed.

After 5-10 seconds, a message window appears which says "Timeout waiting for debugger connection"

Workaround is to go back to ptvsd 4.1.1

Expected behavior

Debugging should be possible for Python scripts with "Python: Current File" as well as "Python: Flask" configurations

Steps to reproduce:

Open a flask application or a single .py file in VS code.
Make sure you have ptvsd version 4.1.2 or 4.1.3
Set the debugging configuration to 'Python: Current File' or "Python: Flask"
Try to debug using F5.

An observation:
I started a Python prompt on integrated terminal and imported ptvsd.
ptvsd.file refers to
"....vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\init.pyc'

The ptvsd.version returns 4.1.1 although I have pip installed ptvsd 4.1.2

Logs

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

C:\Python27\python.exe: No module named ptvsd.main; 'ptvsd' is a package and cannot be directly executed

Activity

  1. DonJayamanne commented on Sep 26, 2018

    @DonJayamanne

    Please could you install the latest development version of the extension from here:
    https://github.com/Microsoft/vscode-python/blob/master/CONTRIBUTING.md#development-build

  2. DonJayamanne commented on Sep 26, 2018

    @DonJayamanne

    The current release version of the extension doesn't allow you to use your own copies of PTVSD, that was never supported. Please install the latest dev version as outlined above and test again.

  3. MandarJKulkarni commented on Oct 2, 2018

    @MandarJKulkarni
    Author

    This error seems to be gone now. I couldn't reproduce the error with the latest development build, although I had installed ptvsd 4.1.2.
    Thank you! Please close this issue.
    I wasn't aware that usage of user's PTVSD copy was never supported before, which makes this issue trivial. If it's documented, I must have missed.

    Observation:
    When I imported ptvsd from Python prompt, it was from my "C:\Python27\lib\site-packages" folder
    Earlier it used to be from ".vscode\extensions" folder.

    Question: Does this mean upcoming Python extension supports using our own copies of PTVSD?

  4. locked as resolved and limited conversation to collaborators on Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-debuggingbugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from poster

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions