Hi,
This is my neovim config for dap. This is specifically python config.
When I tried to debug a python file I get below error.
Dap ErrorJS/Java/scala and go are all working fine. Only python dap is giving error.
Dap Error log is
/opt/homebrew/opt/python@3.13/bin/python3.13: Error while finding module specification for 'debugpy.adapter' (ModuleNotFoundError: No module named 'debugpy')
I have venv environment as well but still getting same error.
Any idea how can I fix this error?
» pip install debugpy
I can't seem to get a virtual environment to work with the dap-debug . I've tried running pyvenv-actviate (pyvenv), but it "exited abnormally".
SOLVED: You need to install debugpy (source /venv/bin/activate && pip install debupy) inside the virtual environment.
You can try the following:
{
"name": "Python: A name example",
"type": "python",
"request": "launch",
"program": "practice1/my_module.py",
"env": {
"PYTHONPATH": "${workspaceFolder}"
},
}
- Using
programinstead ofmoduleis almost the same. - You need to solve the
importsas if you had the package installed. Therfore you need to add aPYTHONPATH.
I have ran into the same issue. You may have two Python interpreters installed and only one has the modules you need. Try selecting another Python version by running from the command pallet (Ctl+Shift+p) then python: Select Interpreter and choose where your python lives. I had:
/usr/bin/python3
/usr/local/bin/python