sublimelsp / LSP-pylsp

Convenience package for the Python Language Server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LSP-pylsp server has crashed

twoeightdev opened this issue · comments

Hi, im starting to learn python and decided to try this for sublime text 4, but im having a crash server.
Here's what i did.

winget install -e --id SublimeHQ.SublimeText.4
winget install -e --id Python.Python.3.11
pip install python-lsp-server[all]

Restart pc and open sublime text 4.
inside sublime text 4, i install LSP and LSP-pylsp

but when i open sublime and open .py file it crashes.

Troubleshooting: LSP-pylsp

Version

  • LSP: 1.21.0
  • Sublime Text: 4143

Server Test Run

  • exit code: 1
  • output
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\hoaxdream\AppData\Local\Sublime Text\Package Storage\LSP-pylsp\Scripts\pylsp.exe\__main__.py", line 4, in <module>
  File "C:\Users\hoaxdream\AppData\Local\Sublime Text\Package Storage\LSP-pylsp\Lib\site-packages\pylsp\__main__.py", line 15, in <module>
    from .python_lsp import (PythonLSPServer, start_io_lang_server,
  File "C:\Users\hoaxdream\AppData\Local\Sublime Text\Package Storage\LSP-pylsp\Lib\site-packages\pylsp\python_lsp.py", line 9, in <module>
    import ujson as json
ImportError: DLL load failed while importing ujson: The specified module could not be found.

Server Configuration

  • command
[
  "$server_path"
]
  • shell command
"C:\Users\hoaxdream\AppData\Local\Sublime Text\Package Storage\LSP-pylsp\Scripts\pylsp.exe"
  • selector
source.python
  • priority_selector
(source.python)
  • init_options
{}
  • settings
{
  "pylsp": {
    "configurationSources": [
      "pycodestyle"
    ], 
    "plugins": {
      "autopep8": {
        "enabled": true
      }, 
      "flake8": {
        "config": null, 
        "enabled": false, 
        "exclude": null, 
        "executable": "flake8", 
        "filename": null, 
        "hangClosing": null, 
        "ignore": null, 
        "maxComplexity": null, 
        "maxLineLength": null, 
        "perFileIgnores": null, 
        "select": null
      }, 
      "jedi": {
        "auto_import_modules": [
          "numpy"
        ], 
        "env_vars": null, 
        "environment": null, 
        "extra_paths": [
          "$sublime_py_files_dir", 
          "$packages"
        ]
      }, 
      "jedi_completion": {
        "cache_for": [
          "pandas", 
          "numpy", 
          "tensorflow", 
          "matplotlib"
        ], 
        "eager": false, 
        "enabled": true, 
        "fuzzy": true, 
        "include_class_objects": false, 
        "include_function_objects": false, 
        "include_params": true, 
        "resolve_at_most": 25
      }, 
      "jedi_definition": {
        "enabled": true, 
        "follow_builtin_definitions": true, 
        "follow_builtin_imports": true, 
        "follow_imports": true
      }, 
      "jedi_hover": {
        "enabled": true
      }, 
      "jedi_references": {
        "enabled": true
      }, 
      "jedi_signature_help": {
        "enabled": true
      }, 
      "jedi_symbols": {
        "all_scopes": true, 
        "enabled": true, 
        "include_import_symbols": true
      }, 
      "mccabe": {
        "enabled": true, 
        "threshold": 15
      }, 
      "preload": {
        "enabled": true, 
        "modules": null
      }, 
      "pycodestyle": {
        "aggressive": null, 
        "enabled": true, 
        "exclude": null, 
        "filename": null, 
        "hangClosing": null, 
        "ignore": null, 
        "maxLineLength": null, 
        "select": null
      }, 
      "pydocstyle": {
        "addIgnore": null, 
        "addSelect": null, 
        "convention": null, 
        "enabled": false, 
        "ignore": null, 
        "match": "(?!test_).*\\.py", 
        "matchDir": "[^\\.].*", 
        "select": null
      }, 
      "pyflakes": {
        "enabled": false
      }, 
      "pylint": {
        "args": null, 
        "enabled": false, 
        "executable": ""
      }, 
      "pyls_isort": {
        "enabled": false
      }, 
      "pylsp_black": {
        "cache_config": false, 
        "enabled": false, 
        "line_length": 88, 
        "preview": false
      }, 
      "pylsp_mypy": {
        "config_sub_paths": [], 
        "dmypy": false, 
        "dmypy_status_file": ".dmypy.json", 
        "enabled": false, 
        "live_mode": true, 
        "overrides": [
          true
        ], 
        "report_progress": false, 
        "strict": false
      }, 
      "rope_autoimport": {
        "enabled": false, 
        "memory": false
      }, 
      "rope_completion": {
        "eager": false, 
        "enabled": false
      }, 
      "yapf": {
        "enabled": false
      }
    }, 
    "rope": {
      "extensionModules": null, 
      "ropeFolder": null
    }
  }
}
  • env
{
  "MYPYPATH": "${sublime_py_files_dir}${pathsep}${packages}", 
  "PATH": "C:\\Users\\hoaxdream\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-pylsp\\Scripts;C:\\Users\\hoaxdream\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-pylsp\\Scripts;C:\\Users\\hoaxdream\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-pylsp\\Scripts;C:\\Users\\hoaxdream\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-pylsp\\Scripts;C:\\Users\\hoaxdream\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-pylsp\\Scripts;C:\\Users\\hoaxdream\\AppData\\Local\\Sublime Text\\Package Storage\\LSP-pylsp\\Scripts;", 
  "PYTHONPATH": "${sublime_py_files_dir}${pathsep}${packages}"
}

Active view

  • File name
C:\Users\hoaxdream\Desktop\src\pythonproj\test.py
  • Settings
{
  "auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc", 
  "lsp_active": null, 
  "syntax": "Packages/Python/Python.sublime-syntax"
}
  • base scope
source.python

Project / Workspace

  • folders
[
  "C:\\Users\\hoaxdream\\Desktop\\src\\pythonproj"
]
  • is project: False

LSP configuration

{}

System PATH

  • C:\Program Files\ImageMagick-7.1.0-Q16-HDRI
  • C:\Windows\system32
  • C:\Windows
  • C:\Windows\System32\Wbem
  • C:\Windows\System32\WindowsPowerShell\v1.0\
  • C:\Windows\System32\OpenSSH\
  • C:\Program Files\Git\cmd
  • C:\Program Files\nodejs\
  • C:\Program Files\MiKTeX\miktex\bin\x64\
  • C:\Users\hoaxdream\scoop\apps\mpv-git\current
  • C:\Users\hoaxdream\scoop\shims
  • C:\Users\hoaxdream\AppData\Local\Programs\Python\Python311\Scripts\
  • C:\Users\hoaxdream\AppData\Local\Programs\Python\Python311\
  • C:\Users\hoaxdream\AppData\Local\Microsoft\WindowsApps
  • C:\Users\hoaxdream\AppData\Roaming\npm
  • C:\Users\hoaxdream\AppData\Local\Pandoc\
  • C:\Users\hoaxdream\AppData\Local\Microsoft\WinGet\Links

Seems like your Windows system is missing some libraries.

Quick googling for similar problems suggests installing Microsoft Visual C++ Redistributable. See: https://stackoverflow.com/a/60513627

BTW. This package manages python-lsp-server so you shouldn't need to install it manually.

Seems like your Windows system is missing some libraries.

Quick googling for similar problems suggests installing Microsoft Visual C++ Redistributable. See: https://stackoverflow.com/a/60513627

BTW. This package manages python-lsp-server so you shouldn't need to install it manually.

Hi sir, yes i already install that with winget x86 and x64 but the problem still there. but i solve my problem by installing Miniconda3. thank you

Do you get the same error when you run "pylsp" on the command line?

yea exact same error:

File "C:\Users\hoaxdream\AppData\Local\Sublime Text\Package Storage\LSP-pylsp\Scripts\pylsp.exe\__main__.py", line 4, in <module>
  File "C:\Users\hoaxdream\AppData\Local\Sublime Text\Package Storage\LSP-pylsp\Lib\site-packages\pylsp\__main__.py", line 15, in <module>
    from .python_lsp import (PythonLSPServer, start_io_lang_server,
  File "C:\Users\hoaxdream\AppData\Local\Sublime Text\Package Storage\LSP-pylsp\Lib\site-packages\pylsp\python_lsp.py", line 9, in <module>
    import ujson as json
ImportError: DLL load failed while importing ujson: The specified module could not be found.

So then you could try asking for help in pylsp's repo.
Though it's more about the specific ujson python package rather than pylsp so you might just go straight to it's repo and ask there. Maybe there is even an existing issue for it :)