Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSP-pylsp uses flake8 from system and not from the cache /bin #66

Closed
valr opened this issue Jun 16, 2021 · 3 comments
Closed

LSP-pylsp uses flake8 from system and not from the cache /bin #66

valr opened this issue Jun 16, 2021 · 3 comments

Comments

@valr
Copy link

valr commented Jun 16, 2021

Hi,
I've installed LSP-pylsp and removed all previous installation of pylsp and flake8 from my system.
After activating LSP-pylsp, it has installed pylsp and dependencies in ~/.cache/sublime-text/Package Storage/LSP-pylsp, including flake8 in the /bin directory of the cache. Then I've activated flake8 in LSP-pylsp.sublime-settings.

It seems pylsp is unable to find flake8 from the cache as I got this error message in the log:
LSP-pylsp: 2021-06-15 22:16:54,692 UTC - ERROR - pylsp.plugins.flake8_lint - Error while running flake8 '/bin/python: No module named flake8'

I've looked at the flake8_lint.py code and found that it's possible to specify the path to flake8 like this:
pylsp.plugins.flake8.executable": "~/.cache/sublime-text/Package Storage/LSP-pylsp/bin/flake8"

However it's undocumented.

I've mentioned it in the LSP chan of the ST discord and @rwols proposed the following:
"what could also work is to add $storage_path/LSP-pylsp/bin to the $PATH programmatically (in LSP-pylsp) before we start the subprocess so that pylsp (the subprocess) will favor those bundled executables"
He also mentioned: "this sounds awfully similar to #64"

Could you check if LSP-pylsp could be modified so flake8 can be used directly from the cache /bin path as proposed above?
Thanks

@rchl
Copy link
Member

rchl commented Jun 16, 2021

I guess the intended use of pylsp is that it's installed globally rather then per-project. So in that case using the global flake8 makes sense. I think we probably will have to override that path. Ideally internally rather than in the settings as that can be an implementation detail.

@rchl
Copy link
Member

rchl commented Jun 17, 2021

Should be fixed when both #67 and sublimelsp/LSP#1752 are released.

@rchl rchl closed this as completed Jun 17, 2021
@valr
Copy link
Author

valr commented Jun 18, 2021

@rchl , thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants