Invalid instructions for `pyls_ms` language server

System information
  • nvim --version:
NVIM v0.5.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az242-526

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/home/runner/work/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info
  • Operating system/version: OpenSUSE Tumbleweed
  • Terminal name/version: gnome-terminal
# GNOME Terminal 3.40.2 using VTE 0.64.2 +BIDI +GNUTLS +ICU +SYSTEMD
  • $TERM: xterm-256color
Context

I’ve been trying to set up neovim for python programming, but I’m having trouble getting completions to behave.

I’ve tried all the language servers listed in the CONFIG.md of neovim/nvim-lspconfig, but both pylsp, pyls and jedi-language-server, once set-up correctly are way too slow to my liking. This seems to be a known problem.

pyright also doesn’t seem to work for me (In the docs, a pyright-langserver command is referenced, but installing pyright via npm or pip3 doesn’t give me such command, only pyright and pyright-python). I’ve also seen mentioned on reddit that pyright doesn’t work on any .pyfile, but that it needs a specific project structure to function. This may be the reason I didn’t manage to get it working, as I did try to change, in the pyright settings:

cmd = { 'pyright-langserver', '--stdio' }

to only { 'pyright' } or { 'pyright-python' } (As neigther supports the --stdio option).


Trying to install pyls_ms in Linux, I’ve encountered a problem installing dotnet. I try the command in the instructions :

curl -L https://dot.net/v1/dotnet-install.sh | sh

However, after this I don’t get the dotnet command which seems to be necessary according to the instructions linked thereafter and provided by microsoft/python-language-server.

This prevents me from continuing the installation.

Any help is appreciated, thank you for your time.

I think you need to add dotnet to your PATH. Can you run dotnet from the CLI?

Also, side-note, python-language-server is basically abandoned in favor of pyright.

1 Like

I can’t find where the dotnet command is supposed to be. I have many files in my filesystem (Which I didn’t know I had), with that name

find / -name dotnet* 2> /dev/null
/home/ayhon/.config/Code/User/globalStorage/ms-vsliveshare.vsliveshare/dotnet-3.1.14
/home/ayhon/.config/Code/User/globalStorage/ms-vsliveshare.vsliveshare/dotnet-3.1.14/dotnet
/home/ayhon/.vscode/extensions/ms-vsliveshare.vsliveshare-1.0.4498/dotnet_modules
/usr/lib/python3.8/site-packages/pygments/lexers/__pycache__/dotnet.cpython-38.opt-1.pyc
/usr/lib/python3.8/site-packages/pygments/lexers/__pycache__/dotnet.cpython-38.pyc
/usr/lib/python3.8/site-packages/pygments/lexers/dotnet.py
/usr/lib/python3.8/site-packages/opi/plugins/__pycache__/dotnet.cpython-38.pyc
/usr/lib/python3.8/site-packages/opi/plugins/dotnet.py
/usr/lib/python3.9/site-packages/pygments/lexers/__pycache__/dotnet.cpython-39.opt-1.pyc
/usr/lib/python3.9/site-packages/pygments/lexers/__pycache__/dotnet.cpython-39.pyc
/usr/lib/python3.9/site-packages/pygments/lexers/dotnet.py
/var/lib/flatpak/runtime/org.gnome.Platform/x86_64/40/2a2992ab0413ae5e067983a9d0e186289f84ea6b9e2bbb17523879131dd354f7/files/lib/python3.8/site-packages/pygments/lexers/dotnet.py
/var/lib/flatpak/runtime/org.gnome.Platform/x86_64/40/2a2992ab0413ae5e067983a9d0e186289f84ea6b9e2bbb17523879131dd354f7/files/lib/python3.8/site-packages/pygments/lexers/__pycache__/dotnet.cpython-38.pyc
/var/lib/flatpak/runtime/org.freedesktop.Sdk/x86_64/20.08/699d38c9e1d5c566179309d47537729022a964f9f442fae59168130a9161c010/files/lib/python3.8/site-packages/pygments/lexers/dotnet.py
/var/lib/flatpak/runtime/org.freedesktop.Sdk/x86_64/20.08/699d38c9e1d5c566179309d47537729022a964f9f442fae59168130a9161c010/files/lib/python3.8/site-packages/pygments/lexers/__pycache__/dotnet.cpython-38.pyc
/mnt/home/ayhon/.tldr/tldr/pages.pl/common/dotnet.md
/mnt/home/ayhon/.tldr/tldr/pages.it/common/dotnet.md
/mnt/home/ayhon/.tldr/tldr/pages.es/common/dotnet-publish.md
/mnt/home/ayhon/.tldr/tldr/pages.es/common/dotnet-build.md
/mnt/home/ayhon/.tldr/tldr/pages.es/common/dotnet-restore.md
/mnt/home/ayhon/.tldr/tldr/pages.es/common/dotnet.md
/mnt/home/ayhon/.tldr/tldr/pages/common/dotnet-publish.md
/mnt/home/ayhon/.tldr/tldr/pages/common/dotnet-build.md
/mnt/home/ayhon/.tldr/tldr/pages/common/dotnet-restore.md
/mnt/home/ayhon/.tldr/tldr/pages/common/dotnet.md
/mnt/home/ayhon/.tldr/tldr/pages.de/common/dotnet.md
/mnt/home/ayhon/.tldr/tldr/pages.ru/common/dotnet-publish.md
/mnt/home/ayhon/.tldr/tldr/pages.ru/common/dotnet-build.md
/mnt/home/ayhon/.tldr/tldr/pages.ru/common/dotnet-restore.md
/mnt/home/ayhon/.tldr/tldr/pages.ru/common/dotnet.md
/mnt/home/ayhon/.tldr/tldr/pages.ko/common/dotnet.md
/mnt/home/ayhon/.steam/debian-installation/steamapps/compatdata/42910/pfx/drive_c/windows/system32/dotnetfx35.exe
/mnt/home/ayhon/.steam/debian-installation/steamapps/compatdata/42910/pfx/drive_c/windows/syswow64/dotnetfx35.exe
/mnt/home/ayhon/.steam/debian-installation/steamapps/common/Magicka/Dependencies/dotnetfx35.exe
/mnt/home/ayhon/.steam/debian-installation/steamapps/common/Proton - Experimental/files/share/wine/mono/wine-mono-6.1.2/support/dotnetfakedlls.inf
/mnt/home/ayhon/.steam/debian-installation/steamapps/common/Proton - Experimental/files/share/default_pfx/drive_c/windows/system32/dotnetfx35.exe
/mnt/home/ayhon/.steam/debian-installation/steamapps/common/Proton - Experimental/files/share/default_pfx/drive_c/windows/syswow64/dotnetfx35.exe
/mnt/home/ayhon/.steam/debian-installation/steamapps/common/Proton - Experimental/files/lib/wine/dotnetfx35.exe
/mnt/home/ayhon/.steam/debian-installation/steamapps/common/Proton - Experimental/files/lib64/wine/dotnetfx35.exe
/mnt/home/ayhon/.vscode/extensions/ms-vsliveshare.vsliveshare-1.0.4131/dotnet_modules
/mnt/home/ayhon/.vscode/extensions/ms-vsliveshare.vsliveshare-1.0.4272/dotnet_modules
/mnt/home/ayhon/.local/share/flatpak/runtime/org.gnome.Platform/x86_64/40/637a049fdf71310e8d1dce9272dc881a04b28d5b12db7bfca9359c9da8f045d0/files/lib/python3.8/site-packages/pygments/lexers/dotnet.py
/mnt/home/ayhon/.local/share/flatpak/runtime/org.gnome.Platform/x86_64/40/637a049fdf71310e8d1dce9272dc881a04b28d5b12db7bfca9359c9da8f045d0/files/lib/python3.8/site-packages/pygments/lexers/__pycache__/dotnet.cpython-38.pyc
/mnt/home/ayhon/.local/share/flatpak/runtime/org.freedesktop.Sdk/x86_64/20.08/ceb3c558b9a3399fcb4d055f82db88513cf30a0f1e79ef986990d4e79b9bf20a/files/lib/python3.8/site-packages/pygments/lexers/dotnet.py
/mnt/home/ayhon/.local/share/flatpak/runtime/org.freedesktop.Sdk/x86_64/20.08/ceb3c558b9a3399fcb4d055f82db88513cf30a0f1e79ef986990d4e79b9bf20a/files/lib/python3.8/site-packages/pygments/lexers/__pycache__/dotnet.cpython-38.pyc
/mnt/home/ayhon/.config/Code/User/globalStorage/ms-vsliveshare.vsliveshare/dotnet-3.1.1
/mnt/home/ayhon/.config/Code/User/globalStorage/ms-vsliveshare.vsliveshare/dotnet-3.1.1/dotnet
/mnt/usr/share/dotnet
/mnt/usr/lib/python3/dist-packages/pygments/lexers/dotnet.py
/mnt/usr/lib/python3/dist-packages/pygments/lexers/__pycache__/dotnet.cpython-38.pyc

I have a separate linux installation mounted in /mnt

However, if you say pyls_ms has been deprecated in favor of pyright, then what can I do about linting on a single file?

This may be turning off-topic, however


EDIT
Also, on a side note. The instructions for pyright in CONFIG.md mention a pyright-langserver which isn’t installed via npm nor pip3.

For me, dotnet is at /usr/bin/dotnet. Depends on how you install it. Guessing for the shell script it’s under $HOME/.dotnet (probably $HOME/.dotnet/bin)

Pyright doesn’t need a root directory marker anymore, it should just work now. I’m not sure what to tell you re: pyright not being detected except that it’s likely also a path issue. The CONFIG.md installation recommendations currently work for me.

I think I’m going to start a new topic on the pyright installation process. I’m going to have dinner, and try it again with a clear mind. Perhaps this is the actual problem. If I’m still having problems, I’ll make a new post, if that’s ok.

Thanks for your time.

Sorry for the off-topic, but I found the solution to my pyright problem.

It was, as you said, a problem with not having the executable in my PATH. I thought that the pyright command may have substituted the pyright-langserver, but that’s not the case. This is what I did:

  1. Locate pyright-langserver on my system with find -name pyright-langserver 2> /dev/null
  2. Make it an executable
    chmod +x .npm/_npx/3699d080662ea149/pyright-langserver in my case
  3. Change the cmd setting in the pyright settings on my init.vim to use this executable. In my case:
  require'lspconfig'.pyright.setup{
  	cmd = {'/home/ayhon/.npm/_npx/3699d080662ea149/node_modules/.bin/pyright-langserver', '--stdio'},
  	filetypes = {"python"},
  	root_dir = util.root_pattern(".git", "setup.py",  "setup.cfg", "pyproject.toml", "requirements.txt"),
  	settings = {
  		python = {
  			analysis = {
  				autoSearchPaths = true,
  				useLibraryCodeForTypes = true,
  			},
  		},
  	}
  }	

  1. Or add the program to your PATH.

And that’s all.


You cant use

cmd = {'node', '/home/ayhon/.npm/_npx/3699d080662ea149/node_modules/.bin/pyright-langserver', '--stdio'}

as an error saying Client 1 quit with exit code 1 and signal 0 will pop up.