pappasam / jedi-language-server

A Python language server exclusively for Jedi. If Jedi supports it well, this language server should too.
MIT License
574 stars 44 forks source link

jedi-language-server crashes right after start with failed import #302

Closed igordertigor closed 2 months ago

igordertigor commented 5 months ago

I'm using jedi-language-server with neovim's nvchad config. The relevant configuration is:

local config = require("plugins.configs.lspconfig")

local on_attach = config.on_attach
local capabilities = config.capabilities

local lspconfig = require("lspconfig")

lspconfig.jedi_language_server.setup{
  on_attach = on_attach,
  capabilities = capabilities,
  filetypes = {"python"},
}

jedi-language-server is installed using mason.

Right after startup, jedi fails with the following error message (replacing \n by actual line breaks and my home dir by ~ for readability / shorter line length):

[ERROR][2024-02-06 10:50:30] .../vim/lsp/rpc.lua:31 "rpc"   "~/.local/share/nvim/mason/bin/jedi-language-server"    "stderr"    "Traceback (most recent call last):
  File \"~/.local/share/nvim/mason/bin/jedi-language-server\", line 5, in <module>
    from jedi_language_server.cli import cli
  File \"~/.local/share/nvim/mason/packages/jedi-language-server/venv/lib/python3.8/site-packages/jedi_language_server/cli.py\", line 8, in <module>
    from .server import SERVER
  File \"~/.local/share/nvim/mason/packages/jedi-language-server/venv/lib/python3.8/site-packages/jedi_language_server/server.py\", line 68, in <module>
    from pygls.protocol import LanguageServerProtocol, lsp_method
  File \"~/.local/share/nvim/mason/packages/jedi-language-server/venv/lib/python3.8/site-packages/pygls/protocol/__init__.py\", line 14, in <module>
    from pygls.protocol.language_server import LanguageServerProtocol, lsp_method
  File \"~/.local/share/nvim/mason/packages/jedi-language-server/venv/lib/python3.8/site-packages/pygls/protocol/language_server.py\", line 64, in <module>
    from lsprotocol.types import (
ImportError: cannot import name 'TraceValues' from 'lsprotocol.types' (~/.local/share/nvim/mason/packages/jedi-language-server/venv/lib/python3.8/site-packages/lsprotocol/types.py)
"

How can I fix this? How can I further debug this? Is anything wrong with my config? It feels that missing imports are likely an oversight during packaging.

pkamenarsky commented 4 months ago

Same here.

coredumper commented 3 months ago

I had the same issue but was able to resolve it manually. The problem was that lsprotocol pre-release version 2024.0.0a1 was installed. Removing that version and installing the current version 2023.0.1 made the problem go away:

$ cd ~/.local/share/nvim/mason/packages/jedi-language-server/venv
$ source bin/activate
$ pip uninstall lsprotocol
$ pip install lsprotocol