No module named 'ptvsd.repl' in Python remote debug

Viewed 1659

I have followed official doc to install ptvsd 3.2.0, and put below code in the very beginning of target code.

import ptvsd
ptvsd.enable_attach('my_secret')

If run this code, I got error:

File "~/.virtualenvs/py3/lib/python3.6/site-packages/ptvsd/__init__.py", line 87, in enable_attach
    return _attach_server().enable_attach(secret, address, certfile, keyfile, redirect_output)
File "~/.virtualenvs/py3/lib/python3.6/site-packages/ptvsd/__init__.py", line 31, in _attach_server
    import ptvsd.attach_server
File "~/.virtualenvs/py3/lib/python3.6/site-packages/ptvsd/attach_server.py", line 40, in <module>
    import ptvsd.debugger as vspd
File "~/.virtualenvs/py3/lib/python3.6/site-packages/ptvsd/debugger.py", line 49, in <module>
    import ptvsd.repl as _vspr

ModuleNotFoundError: No module named 'ptvsd.repl'

3 Answers

I've installed it globally by specifying certain python because my default python is 3.9 but for azure-functions I needed it installed in 3.8

/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -m pip install ptvsd

Of course you must replace my python version with yours

But ptvsd IS DEPRECATED and replaced with debugpy

Related