sublimelsp / LSP-pylsp

Convenience package for the Python Language Server
MIT License
72 stars 5 forks source link

Unalbe to start subprocess for LSP-pylsp #125

Open thewchan opened 1 year ago

thewchan commented 1 year ago

I'm seeing this message in ST4 console that's somewhat mysterious:

Unable to start subprocess for LSP-pylsp
Traceback (most recent call last):
  File "C:\Users\mchan811\AppData\Roaming\Sublime Text\Installed Packages\LSP.sublime-package\plugin/core/windows.py", line 241, in start_async
    plugin_class.install_or_update()
  File "C:\Users\mchan811\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\_client_handler\abstract_plugin.py", line 109, in install_or_update
    server.install_or_update()
  File "C:\Users\mchan811\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\server_pip_resource.py", line 97, in install_or_update
    self.run(self._python_binary, '-m', 'venv', self._package_name, cwd=self._storage_path)
  File "C:\Users\mchan811\AppData\Roaming\SUBLIM~1\Packages\LSP_UT~1\st3\lsp_utils\server_pip_resource.py", line 35, in run
    raise Exception(error)
Exception: Error: [WinError 2] The system cannot find the file specified

I tried reinstalling both LSP-pylsp and the LSP package to no avail. Any suggestions?

rchl commented 1 year ago

You need python installed. Its mentioned in the readme.

thewchan commented 1 year ago

@rchl I have python installed?

rchl commented 1 year ago

Then it appears that it's not in your PATH. Please read https://lsp.sublimetext.io/troubleshooting/#updating-the-path-used-by-lsp-servers

thewchan commented 1 year ago

@rchl here some my project config that's relevant to pylsp:

            "LSP-pylsp": {
                "python_binary": "C:\\Users\\mchan811\\.conda\\envs\\streamlit\\python.exe",
                "disabled_capabilities": {
                    "completionProvider": true,
                    "definitionProvider": true,
                    "documentHighlightProvider": true,
                    "documentSymbolProvider": true,
                    "hoverProvider": true,
                    "referencesProvider": true,
                    "renameProvider": true,
                    "signatureHelpProvider": true,
                },
thewchan commented 1 year ago

I'm using lsp-pyright as well and I don't have any problems

thewchan commented 1 year ago

@rchl I'm pretty sure it's in my PATH, because it works with lsp-pyright. I'm just having trouble with pylsp

rchl commented 1 year ago

lsp-pyright doesn't use python binary - it's built in javascript.

That "python_binary" setting should in theory work, as long that path is correct. Does it work to run that path on the command line?

thewchan commented 1 year ago

Got it re: pyright, that make sense.

Here's on the CLI/terminal:

image

thewchan commented 1 year ago

@rchl I'm trying to do both env and python_binary now but still no go

image

thewchan commented 1 year ago

@rchl maybe it's something to do with virtual envs? I'm using conda envs

rchl commented 1 year ago

env shouldn't be relevant at this point. It's not used for that functionality.

It feels like your custom python_binary is not used but not sure why. Would need to try to reproduce on Windows at some point.

And even if not relevant for this issue, the PATH is supposed to point at a directory, not a file.

thewchan commented 1 year ago

@rchl should I try to point PATH in the config to a directory?

rchl commented 10 months ago

I've realized now that python_binary is not supported in project settings. Only in LSP-pylsp settings. There is no easy way of fixing that.