Can anyone help me get things like "Go to definition" working with Neovim and Python virtual environments?

My setup currently uses a specific virtual environment for Neovim (as recommended by :checkhealth) which is working fine.

I've installed python-language-server and pyls-mypy into that virtual environment.

In my .vimrc I've got w0rp/ale installed with the following configuration:

let g:ale_linters = {
      \ 'python': ['flake8', 'pyls']
let g:ale_virtualenv_dir_names = ['.venv']

I'm now in a directory with a virtual environment in ./.venv (which isn't activated) and can't get any LSP stuff like :ALEGoToDefinition to work.

What am I missing?

1 Answer 1


I finally resolved this by installed python-language-server globally like this:

sudo -H pip install python-language-server

I don't know how popular a solution this will be, but it works for me, so I'm happy.

Since the ale documentation for ALEGoToDefinition says

Jump to the definition of a symbol under the cursor using the enabled LSP
linters for the buffer. ALE will jump to a definition if an LSP server
provides a location to jump to. Otherwise, ALE will do nothing.

the language server is probably necessary.

  • 1
    If this worked for you, please consider accepting the answer!
    – D. Ben Knoble
    Dec 4, 2019 at 13:31

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.