You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem: Detection of the pynvim module is currently done by finding the
first Python interpreter in the `PATH` and checking if it can import
pynvim. This has several effects:
- Activation of an unrelated Python virtual environment will break
automatic detection, unless pynvim is also installed in that
environment.
- Installing pynvim to the expected location is difficult. User
installation into the system-wide or user-wide Python site area is now
deprecated. On Ubuntu 24.04 with Python 3.12, for example, the
command `pip install --user pynvim` now fails with the error message
`error: externally-managed-environment`.
- Users may create a dedicated virtual environment in which to install
pynvim, but Neovim won't detect it; instead, they must either activate
it before launching Neovim (which interferes with the user of other
virtual environments) or else hard-code the variable
`g:python3_host_prog` in their `init.vim` to the path of the correct
Python interpreter. Neither option is desirable.
Solution: Expose pynvim's Python interpreter on the `PATH` under the
name `pynvim-python`. In the typical flow:
- User installs either uv or pipx.
- User installs pynvim via:
uv tool install --upgrade pynvim
# Or:
pipx install --upgrade pynvim
With corresponding changes in Neovim, the above is all that's needed for
Neovim to detect the installed location of pynvim, even if an unrelated
Python virtual environments is activated. It uses standard Python
tooling to automate the necessary creation of a Python virtual
environment for pyenv and the publication of `pynvim-python` to a
directory on `PATH`.
See #593 for additional
discussion of this idea.
0 commit comments