LSP Python Starting
-
- Posts: 11
- Joined: 01.04.2025 14:17
LSP Python Starting
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
"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
-
- Posts: 2428
- Joined: 25.08.2021 18:15
Re: LSP Python Starting
This is Linux this time, ok.
What does the command show in OS terminal:
It finds 'pylsp'?
What does the command show in OS terminal:
Code: Select all
which pylsp
-
- Posts: 2428
- Joined: 25.08.2021 18:15
Re: LSP Python Starting
And: did you try to write the FULL path of pylsp to the settings/lsp_py.json ?
-
- Posts: 11
- Joined: 01.04.2025 14:17
Re: LSP Python Starting
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
It gives the path to
/home/user1/.local/bin/pylsp
I added the full path to lsp_py.json and now it works, thanks
-
- Posts: 2428
- Joined: 25.08.2021 18:15
Re: LSP Python Starting
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')
-
- Posts: 11
- Joined: 01.04.2025 14:17
Re: LSP Python Starting
The only thing I changed was lsp_py.json
The only other change was done by pipx during install (pipx ensurepath)
at end of .bashrc
Code: Select all
{
"lexers": {
"Python": "python"
},
"cmd_windows": ["pylsp.exe"],
"cmd_macos": ["pylsp"],
"cmd_unix": ["/home/user1/.local/bin/pylsp"]
}
at end of .bashrc
Code: Select all
# Created by `pipx` on 2025-04-03 11:36:07
export PATH="$PATH:/home/user1/.local/bin"
-
- Posts: 11
- Joined: 01.04.2025 14:17
Re: LSP Python Starting
From cudatext console
gives
From debian terminal window
gives
...not sure if it is important, but debian terminal has the extra path that is needed.
Code: Select all
print(os.environ.get('PATH'))
Code: Select all
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
Code: Select all
echo $PATH
Code: Select all
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/user1/.local/bin
-
- Posts: 2428
- Joined: 25.08.2021 18:15
Re: LSP Python Starting
so if you run Cud from the same terminal window (with full PATH) , it still sees 'old' PATH.
so environment is not inherited.
weird.
so environment is not inherited.
weird.
-
- Posts: 11
- Joined: 01.04.2025 14:17
Re: LSP Python Starting
If I open Cudatext from terminal command line then I do get the extra path I need..
gives
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
Code: Select all
print(os.environ.get('PATH'))
Code: Select all
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/user1/.local/bin
BTW, I had similar issues with freepascal and trying to open files using TProcess
https://forum.lazarus.freepascal.org/in ... 547.0.html
-
- Posts: 2428
- Joined: 25.08.2021 18:15
Re: LSP Python Starting
it means that clicking Desktop shortcut, does not inherit all PATH contents to child process. it's not Cud nor Freepascal issue, i guess.