sublimelsp / LSP-pylsp

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

Plugin getting installed under the wrong version of python? #152

Closed unformatt closed 7 months ago

unformatt commented 7 months ago

I'm on SublimeText 4169. I've just upgraded SublimeText because I started getting LSP-pylsp failures last month (see error below).

As far as I understand, mypy 1.8.0 is not available for python 3.3. And the newest SublimeText plugin API should be python 3.8. However, when I uninstall and re-install LSP-pylsp, it appears to be installing via python 3.3:

Package Control: Installed package "LSP-pylsp" 2.18.0
reloading settings Packages/LSP-pylsp/LSP-pylsp.sublime-settings
reloading python 3.3 plugin LSP-pylsp.plugin

The error that popups once the plugin is loaded:

--- Error: ---
Error installing the server:
Collecting mypy==1.8.0 (from -r /Users/xxx/Library/Caches/Sublime Text 3/Package Storage/LSP-pylsp/requirements.txt (line 1))
Could not find a version that satisfies the requirement mypy==1.8.0 (from -r /Users/xxx/Library/Caches/Sublime Text 3/Package Storage/LSP-pylsp/requirements.txt (line 1)) (from versions: 0.1, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.221, 0.222, 0.223, 0.224, 0.225, 0.226, 0.227, 0.228, 0.229, 0.230, 0.231, 0.232, 0.233, 0.234, 0.235, 0.236, 0.237, 0.238, 0.239, 0.240, 0.241, 0.250, 0.251, 0.252, 0.253, 0.254, 0.255, 0.256, 0.470, 0.471, 0.501, 0.510, 0.511, 0.520, 0.521, 0.530, 0.540, 0.550, 0.560, 0.570, 0.580, 0.590, 0.600, 0.610, 0.620, 0.630, 0.641, 0.650, 0.660, 0.670, 0.700, 0.701, 0.710, 0.711, 0.720, 0.730, 0.740, 0.750, 0.760, 0.761, 0.770, 0.780, 0.781, 0.782, 0.790, 0.800, 0.812, 0.900, 0.901, 0.902, 0.910, 0.920, 0.921, 0.930, 0.931, 0.940, 0.941, 0.942, 0.950, 0.960, 0.961, 0.971, 0.981, 0.982, 0.990, 0.991, 1.0.0, 1.0.1, 1.1.1, 1.2.0, 1.3.0, 1.4.0, 1.4.1)
No matching distribution found for mypy==1.8.0 (from -r /Users/xxx/Library/Caches/Sublime Text 3/Package Storage/LSP-pylsp/requirements.txt (line 1))
unformatt commented 7 months ago

Further info, /Users/xxx/Library/Caches/Sublime Text 3/Package Storage/LSP-pylsp/pyvenv.cfg implies that python 3.7 is being used (seems odd to me since I thought the options for plugins ver 3.3 or 3.8). mypy==1.8.0 is not available for 3.7 either.

home = /Library/Frameworks/Python.framework/Versions/3.7/bin
include-system-site-packages = false
version = 3.7.4
rchl commented 7 months ago

The python runtime version this package runs on is not relevant to your issue. The pylsp dependencies are installed using your system python. If it's not the one you'd expect it to be then you have to make sure that Sublime Text sees the one you want. See https://lsp.sublimetext.io/troubleshooting/#updating-the-path-used-by-lsp-servers

rchl commented 7 months ago

There is also a setting to override the python binary if you want that to be localized to just LSP-pylsp: https://github.com/sublimelsp/LSP-pylsp?tab=readme-ov-file#python-binary

unformatt commented 7 months ago

Ah ha - Thank for you pointing me in the right direction!