sublimelsp / LSP-pylsp

Convenience package for the Python Language Server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unalbe to start subprocess for LSP-pylsp

thewchan opened this issue · comments

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?

You need python installed. Its mentioned in the readme.

@rchl I have python installed?

@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,
				},

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

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

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?

Got it re: pyright, that make sense.

Here's on the CLI/terminal:

image

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

image

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

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.

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

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.