Page 1 of 1
LSP Python Starting
Posted: 03.04.2025 14:40
by Michael Collier
Testing LSP Pyton (debian) I get error message in console..
"NOTE: LSP: Python - Failed to create process, command: ['pylsp']; Error: [Errno 2] No such file or directory: 'pylsp'"
I installed (used pipx rather than pip, does it matter?)
pipx install python-lsp-server
pipx ensurepath
pylsp --help
also..
whereis pylsp
pylsp: /home/user1/.local/bin/pylsp
In cudatext Terminal PLus window I can invoke pylsp --help
I've reboted the machine, but still no luck, any ideas?
Thanks,
Mike
Re: LSP Python Starting
Posted: 03.04.2025 15:30
by main Alexey
This is Linux this time, ok.
What does the command show in OS terminal:
It finds 'pylsp'?
Re: LSP Python Starting
Posted: 03.04.2025 15:32
by main Alexey
And: did you try to write the FULL path of pylsp to the settings/lsp_py.json ?
Re: LSP Python Starting
Posted: 03.04.2025 15:40
by Michael Collier
which pylsp
It gives the path to
/home/user1/.local/bin/pylsp
I added the full path to lsp_py.json and now it works, thanks
Re: LSP Python Starting
Posted: 03.04.2025 16:59
by main Alexey
Config lsp_py.json allows many options. one of them is 'env_paths' - list of paths. I hope you did not change it.
Code: Select all
# language.py
self._server_cmd = cfg.get(CMD_OS_KEY)
self._tcp_port = cfg.get('tcp_port') # None => use Popen
self._work_dir = cfg.get('work_dir')
# paths to add to env -- {var_name: list[paths]}
self._env_paths = cfg.get('env_paths')
self._log_stderr = bool(cfg.get('log_stderr'))
self._format_on_save = bool(cfg.get('format_on_save'))
self._disabled_contexts_for_server = cfg.get('disabled_contexts')
Re: LSP Python Starting
Posted: 03.04.2025 17:39
by Michael Collier
The only thing I changed was lsp_py.json
Code: Select all
{
"lexers": {
"Python": "python"
},
"cmd_windows": ["pylsp.exe"],
"cmd_macos": ["pylsp"],
"cmd_unix": ["/home/user1/.local/bin/pylsp"]
}
The only other change was done by pipx during install (pipx ensurepath)
at end of .bashrc
Code: Select all
# Created by `pipx` on 2025-04-03 11:36:07
export PATH="$PATH:/home/user1/.local/bin"
Re: LSP Python Starting
Posted: 03.04.2025 18:00
by Michael Collier
From cudatext console
gives
Code: Select all
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
From debian terminal window
gives
Code: Select all
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/user1/.local/bin
...not sure if it is important, but debian terminal has the extra path that is needed.
Re: LSP Python Starting
Posted: 03.04.2025 18:03
by main Alexey
so if you run Cud from the same terminal window (with full PATH) , it still sees 'old' PATH.
so environment is not inherited.
weird.
Re: LSP Python Starting
Posted: 03.04.2025 18:39
by Michael Collier
If I open Cudatext from terminal command line then I do get the extra path I need..
gives
Code: Select all
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/user1/.local/bin
In my earlier post I was starting cudatext via Desktop shortcut.
BTW, I had similar issues with freepascal and trying to open files using TProcess
https://forum.lazarus.freepascal.org/in ... 547.0.html
Re: LSP Python Starting
Posted: 04.04.2025 15:01
by main Alexey
it means that clicking Desktop shortcut, does not inherit all PATH contents to child process. it's not Cud nor Freepascal issue, i guess.