Closed predmijat closed 2 years ago
nvim-dap-python only recognizes the VIRTUAL_ENV
and CONDA_PREFIX
environment variables. You need to activate the virtual env up-front before starting neovim for it to get recognized.
Considering I have pyrightconfig.json
in the project directory which has info on venvPath
and venv
, solved with this zsh function:
function vv() {
venv_path=$(rg venvPath pyrightconfig.json | awk '{print $NF}' | tr -d '"')
venv=$(rg "venv\"" pyrightconfig.json | awk '{print $NF}' | tr -d '"' | tr -d ',')
export VIRTUAL_ENV="${venv_path}/${venv}"
nvim
}
Added a way to customize the logic: https://github.com/mfussenegger/nvim-dap-python/pull/70
Hi,
I've installed both
nvim-dap
andnvim-dap-python
:debugpy
is installed in a separatepyenv
-~/.pyenv/versions/dap/bin/python
.When I open
main.py
of some Python project while being in a directory wherepyenv
is recognized/activated (and I can runpython main.py
and it will all work) and run:lua require'dap'.toggle_breakpoint()<cr>
I see the prompt where I choose1: Launch file
, it will fail on importing first library that is not in standard lib (but is installed withpip
) - it seems that dap didn't recognized the virtualenv created withpyenv
.Let me know if any other info is needed.
Thanks!