4

I'm trying to switch from vscode to neovim. I have coc.nvim configured for pyright but now neovim provides native support for language-server. So I tried to configure python-language-server. I have installed pyls by pip install python-language-server. I went through the documentation for lsp-quickstart. It says that I just need to add neovim/nvim-lspconfig to my plugins and then add lua require('lspconfig').pyls.setup{} to my init.vim. After refreshing I'm getting Error:

E5108: Error executing lua [string ":lua"]:1: attempt to index field 'pyls' (a nil value)

I tried googling it but didn't find any relevant answer. Please help me out if you've configured it.

2 Answers 2

9

Hey so it looks like there is a new fork of pyls. I had the same issue and the following worked for me!

See Here:

https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#pylsp

And Here:

https://github.com/python-lsp/python-lsp-server

Try:

pip install 'python-lsp-server[all]'

Then in init.vim change:

lua require('lspconfig').pyls.setup{}

to

lua require('lspconfig').pylsp.setup{}

Note: pyls changes to pylsp

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot. It's working now.
1

Or you can install all packages with package manager in Linux, for instance:

sudo apt-get install 'python3-pylsp*'

Notice * which will install all pylsp packages.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.