Startup errors in Neovim on windows
sandyscott opened this issue · 3 comments
Hi,
I get a whole bunch of errors when starting Neovim, or forcing plugins to update:
Error invoking 'python_execute' on channel 3 (python3-script-host):
Traceback (most recent call last):
File "C:\Users\[my username]\.vim\plugged\vim-conda\plugin\vimconda.py", line 54, in func
v = self.cache[key]
KeyError: (('import site, sys, os; sys.stdout.write(os.path.pathsep.join(site.getsitepackages()))',), ())
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\[my username]\.vim\plugged\vim-conda\plugin\vimconda.py", line 216, in insert_system_py_sitepath
sitedirs = vim_conda_runpyshell(cmd)
File "C:\Users\[my username]\.vim\plugged\vim-conda\plugin\vimconda.py", line 58, in func
v = self.cache[key] = f(*args, **kwargs), time.time()
File "C:\Users\[my username]\.vim\plugged\vim-conda\plugin\vimconda.py", line 151, in vim_conda_runpyshell
return check_output('python -c "{}"'.format(cmd),
File "C:\Users\[my username]\Anaconda3\envs\neovim_python3\lib\subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:\Users\[my username]\Anaconda3\envs\neovim_python3\lib\subprocess.py", line 512, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'python -c "import site, sys, os; sys.stdout.write(os.path.pathsep.join(site.getsitepackages()))"' returned non-zero exit status 9009.
I'm running Neovim 0.4.3 with the nvim-qt wrapper on Windows 10
I've set up environments for python 2 and 3 with pynvim in each, and configured python_host_prog and python3_host_prog - :checkhealth provider
says both are OK:
## Python 2 provider (optional)
- INFO: Using: g:python_host_prog = "C:\Users\[my username]/Anaconda3/envs/neovim_python2/python"
- INFO: Executable: C:\Users\[my username]\Anaconda3\envs\neovim_python2\python
- INFO: Python version: 2.7.15
- INFO: pynvim version: 0.4.1
- OK: Latest pynvim is installed.
## Python 3 provider (optional)
- INFO: Using: g:python3_host_prog = "C:\Users\[my username]/Anaconda3/envs/neovim_python3/python"
- INFO: Executable: C:\Users\[my username]\Anaconda3\envs\neovim_python3\python
- INFO: Python version: 3.8.3
- INFO: pynvim version: 0.4.1
- OK: Latest pynvim is installed.
How can I get this working?
Kind regards,
Sandy
EDIT: I should have said - I disabled all other plugins (except for vim-plug) to eliminate those as an issue.
Hi @sandyscott
Thanks for your detailed report. I don't have any bandwidth to look at this myself, and I haven't used vim-conda in a long time either (years) so I won't be able to help. Hopefully one of the other maintainers can help. Otherwise you're on your own to make it work on nvim. But what I can tell you is if you manage to submit a PR that adds nvim support and doesn't break vim support I am very likely to merge it 😊
Thanks. I think my lack of understanding is most of the problem. Basically, I was expecting to start nvim-qt.exe and :CondaChangeEnv
would just work.
I think I'm going to leave it for now (I have some other reasons why the workflow I was aiming for isn't going to work) but I've done a bit more digging which might help someone who knows more about this:
- If I start Neovim from command prompt with an activated (non-base) environment it seems to start OK without errors.
- If "base" is the active environment, vim-conda starts, but gives the following message *****:
Could not find a matching env in the list.
This probably means that you are using a local
(prefix) Conda env.
This should be fine, but changing to a named env
may make it difficult to reactivate the prefix env.
However, environment switching just doesn't seem to work properly in either case. The python environment appears to change, but conda doesn't register that change. ie.
Lets say I have 2 environments:
- env1: python 3
- env2: python 2
If i start in env1, :!python -V
gives what I'd expect. I can change to env2 with and :!python -V
changes to reflect the new environment. However, if I try to change environment again, it still thinks I'm in env1, so doesn't give the option to switch to env1 in the wildmenu. Also :!conda info
always shows the startup environment, not what I've switched to.
***** I suspect this is due to the mismatch between the contents of the wildmenu and env list. On my system conda env list
gives:
# conda environments:
#
base C:\Users\[my username]\Anaconda3
env1 * C:\Users\[my username]\Anaconda3\envs\env1
env2 C:\Users\[my username]\Anaconda3\envs\env2
neovim_python2 C:\Users\[my username]\Anaconda3\envs\neovim_python2
neovim_python3 C:\Users\[my username]\Anaconda3\envs\neovim_python3
But the :CondaChangeEnv
looks like:
Anaconda3
env2
neovim_python2
neovim_python3
root
Change conda env [current: env1]: Anaconda3
ie. base
is missing, and instead we have Anaconda3
and root