python-lsp / python-lsp-server

Fork of the python-language-server project, maintained by the Spyder IDE team and the community
MIT License
1.75k stars 186 forks source link

cannot import ujson #493

Open Lewenhaupt opened 7 months ago

Lewenhaupt commented 7 months ago

Not sure what is wrong, installed it with Mason-lsp in neovim and get the following error, any advice is appreciated:

[ERROR][2023-11-26 19:05:47] .../vim/lsp/rpc.lua:734    "rpc"   "/home/hugo/.local/share/nvim/mason/bin/pylsp"  "stderr"    '    from pylsp.__main__ import main\n  File "/home/hugo/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/pylsp/__main__.py", line 15, in <module>\n'
[ERROR][2023-11-26 19:05:47] .../vim/lsp/rpc.lua:734    "rpc"   "/home/hugo/.local/share/nvim/mason/bin/pylsp"  "stderr"    '    from .python_lsp import (\n  File "/home/hugo/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/pylsp/python_lsp.py", line 11, in <module>\n'
[ERROR][2023-11-26 19:05:47] .../vim/lsp/rpc.lua:734    "rpc"   "/home/hugo/.local/share/nvim/mason/bin/pylsp"  "stderr"    "    import ujson as json\nImportError: libstdc++.so.6: cannot open shared object file: No such file or directory\n"

Running pylsp straight from commandline works, but it fails with the same error as above if I add --tcp.

I also tried updating gcc via build-essentials and it's on the latest version but it still doesn't work.

Lewenhaupt commented 7 months ago

I also tried installing with apt-get but that fails with this error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package python3-pylsp
ccordoba12 commented 7 months ago

Hey @Lewenhaupt, thanks for reporting. Please run in a terminal

sudo apt install libstdc++6 lib32stdc++6

That should fix your problem.

fnuttens commented 1 month ago

Hey there!

I have a similar issue but no mention of C++ libs:

2024-05-23T09:16:52.936 helix_lsp::transport [ERROR] pylsp err <- "Traceback (most recent call last):\r\n"
2024-05-23T09:16:52.937 helix_lsp::transport [ERROR] pylsp err <- "  File \"<frozen runpy>\", line 198, in _run_module_as_main\r\n"
2024-05-23T09:16:52.937 helix_lsp::transport [ERROR] pylsp err <- "  File \"<frozen runpy>\", line 88, in _run_code\r\n"
2024-05-23T09:16:52.937 helix_lsp::transport [ERROR] pylsp err <- "  File \"~\\scoop\\apps\\python\\current\\Scripts\\pylsp.exe\\__main__.py\", line 4, in <module>\r\n"
2024-05-23T09:16:52.942 helix_lsp::transport [ERROR] pylsp err <- "  File \"~\\scoop\\apps\\python\\current\\Lib\\site-packages\\pylsp\\__main__.py\", line 15, in <module>\r\n"
2024-05-23T09:16:52.943 helix_lsp::transport [ERROR] pylsp err <- "    from .python_lsp import (PythonLSPServer, start_io_lang_server,\r\n"
2024-05-23T09:16:52.943 helix_lsp::transport [ERROR] pylsp err <- "  File \"~\\scoop\\apps\\python\\current\\Lib\\site-packages\\pylsp\\python_lsp.py\", line 9, in <module>\r\n"
2024-05-23T09:16:52.943 helix_lsp::transport [ERROR] pylsp err <- "    import ujson as json\r\n"
2024-05-23T09:16:52.943 helix_lsp::transport [ERROR] pylsp err <- "ModuleNotFoundError: No module named 'ujson'\r\n"

I installed pylsp using scoop (Windows) for helix editor.