I recently switched to nvim + tmux and I have a fully working setup with various plugins. I use Poetry to manage my python virtual envs and it's a mandatory tool. I highlight the fact that my python setup in neovim is fully working. LSP is responding well and I have all the benefits of this tool.
- When I don't source my python virtual env before launching
nvim, it'a a fully working setup
- When I source the virtual env created with
poetry, I get multiple bugs in the user interface of
nvim. It's related to tmux because these bugs appears when I create panes.
I'd really need to be able to use poetry since I have a lot of project using it. But I still don't want to return on Pycharm, but I have no clue on how to tackle this issue since it seems to be very specific. Any idea on what could be leading to this ?
I have a very simple setup of python in my workstation :
- Python 3.6 to 3.10 installed with the official installer for macOS
- I don't use Pyenv
- I never install anything with
- I have several Python executables installed with
pipx(such as Flake8, iPython and others)
- one of these
pipxenvs is used for setting various packages related to LSP and it's declared as global in my nvim settings
# the declaration of the env in my nvim settings vim.g.python3_host_prog = "$HOME/.local/pipx/venvs/python-lsp-server/bin/python" # details of this env managed by pipx package python-lsp-server 1.4.1, installed using Python 3.10.4 - pylsp Injected Packages: - flake8 4.0.1 - greenlet 1.1.2 - jedi-language-server 0.36.0 - msgpack 1.0.4 - pylint 2.14.0 - pyls-isort 0.2.2 - pylsp-mypy 0.5.8 - pynvim 0.4.3 - vim-vint 0.3.21
- I use
poetryto create one virtual env for each project
- I used this setup outside of a tmux session and its working well but the whole point of my config is to work within tmux.
- I test it against a barebone nvim setup (
nvim -u none) to check it there is something wrong with my plugins and the issues are still there.
- I tried with a virtual env created with the native python tools (
python3 -m venv ./.venv-name) : there is no issue.
- So I test a
poetrysetup where the venv is installed in the current directory but it still doesn't work.
Screenshots and nvim diagnostics
## Python 3 provider (optional) - INFO: Using: g:python3_host_prog = "$HOME/.local/pipx/venvs/python-lsp-server/bin/python" - INFO: Executable: /Users/azp/.local/pipx/venvs/python-lsp-server/bin/python - INFO: Python version: 3.10.5 - INFO: pynvim version: 0.4.3 - OK: Latest pynvim is installed. ## Python virtualenv - WARNING: $VIRTUAL_ENV is set to: /Users/azp/dev/temp/.venv And its /bin directory contains: python, python3, python3.10 But $PATH in subshells yields this python3 executable: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3 And $PATH in subshells yields this python3.10 executable: /Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 So invoking Python may lead to unexpected results. - ADVICE: - $PATH ambiguities in subshells typically are caused by your shell config overriding the $PATH previously set by the virtualenv. Either prevent them from doing so, or use this workaround: https://vi.stackexchange.com/a/34996
Interface when poetry venv is NOT sourced
Issue when poetry venv is sourced
Creation of the panes and already there are an issue with the canvas and the status line :
After closing the panes the nvin presents the following issues :