Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MandarJKulkarni opened this issue Sep 26, 2018 · 3 comments
Labels
area-debugging bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@MandarJKulkarni
Copy link

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

@DonJayamanne
Copy link

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

@DonJayamanne DonJayamanne added info-needed Issue requires more information from poster and removed needs upstream fix labels Sep 26, 2018
@DonJayamanne
Copy link

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.

@MandarJKulkarni
Copy link
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?

@lock lock bot locked as resolved and limited conversation to collaborators Oct 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-debugging bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants