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
{{ message }}
Repository navigation
Different python version in neovim python3 host and virtualenv python #19
Consider a case where g:python3_host_prog is set to /usr/bin/python (3.5.x), and the current shell (e.g. $PATH) uses another python from virtualenv or anaconda, with different version (3.6.x).
In this case, Syntax from python 3.6+ is not supported. e.g.
99var=1E>100print(f'{var}')
Output of :Semshi error is
Syntax error: invalid syntax (100, 14)
Is this a neovim-related issue? Can we configure python being used in code checking other than neovim's host python (or autodetect from $PATH)?
Thanks for raising this, I knew someone would eventually do. It's a known limitation which doesn't make it less of a problem though. From the README:
Semshi works with the same syntax version as your Neovim Python 3 provider. This means you can't use Semshi on code that's Python 2-only or uses incompatible syntax features.
Semshi is simply retrieving the AST via Python's ast module which depends on the version of the Python provider which is running the plugin.
But thinking about it, there may be viable workarounds to get AST and symtable via another Python distribution. I'll investigate if it's feasible to e.g. get the information doing IPC with a different Python process (seems like a significant overhead) or cross-import the modules between versions (which sounds like it's going to get messy) and let you know.
So the current approach I am using (and, what I'd recommend) is to set correctg:python3_host_prog as the path your python interpreter, inside the virtualenv/condaenv. This variable could be set dynamically on neovim startup.
Activity
numirias commentedon Sep 19, 2018
Thanks for raising this, I knew someone would eventually do. It's a known limitation which doesn't make it less of a problem though. From the README:
Semshi is simply retrieving the AST via Python's
astmodule which depends on the version of the Python provider which is running the plugin.But thinking about it, there may be viable workarounds to get AST and symtable via another Python distribution. I'll investigate if it's feasible to e.g. get the information doing IPC with a different Python process (seems like a significant overhead) or cross-import the modules between versions (which sounds like it's going to get messy) and let you know.
neovim: Use local (venv, conda) python3 as neovim host if appropriate
wookayin commentedon Nov 7, 2018
So the current approach I am using (and, what I'd recommend) is to set correct
g:python3_host_progas the path your python interpreter, inside the virtualenv/condaenv. This variable could be set dynamically on neovim startup.