The instructions at nvim-dap-python recommends to install debugpy into a dedicated virtualenv, and the pass the path of the python executable in that virtualenv to nvim-dap-python with:


I noticed that debugpy can be installed via mason.nvim (and automate the install with mason-tool-installer). But how can I use the Mason installed debugpy (:MasonInstall debugpy) with nvim-dap-python? Where is the path to the debugpy virtualenv in this case?

1 Answer 1


When you run :MasonInstall debugpy it will be installed on the standard directory "data" (vim.fn.stdpath('data'), see :h stdpath()), the full path would be something like /Users/ecerulm/.local/share/nvim/mason/packages/debugpy/venv/bin/python where /Users/ecerulm/.local/share/nvim is the stdpath('data').

So then to configure this path in nvim-dap-python you can use

    local python_path = table.concat({ vim.fn.stdpath('data'),  'mason', 'packages', 'debugpy', 'venv', 'bin', 'python'}, '/'):gsub('//+', '/')

The table.concat() and gsub could be replaced with vim.fn.joinpath() if you are using Neovim 0.10.x (that would be released around May 2024)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.