I have a strange problem regarding Python,
asdf-vm and SpaceVim. It doesn't happen with plain Neovim.
When I use
asdf-vm to activate a different Python version in my shell than is configured in the `g:python3_host_prog` and `python_interpreter` options, the output of `:echo has("python3")` is `0` instead of `1`.
--------------
To reproduce:
1. Install
asdf-vmgit clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2
. $HOME/.asdf/asdf.sh # add to bashrc to load automatically
. $HOME/.asdf/completions/asdf.bash # add to bashrc to load automatically2. Install 2 python versions with asdf-vm
asdf install python 3.10.6
asdf install python 3.10.43. Configure these config files for SpaceVim:
# .SpaceVim.d/init.toml
[options]
bootstrap_before = 'myspacevim#before'
bootstrap_after = 'myspacevim#after'
[[layers]]
name = 'lang#python'
python_interpreter = '~/.asdf/installs/python/3.10.6/bin/python'
# .SpaceVim.d/autoload/myspacevim.vim
function! myspacevim#before() abort
let g:python3_host_prog = '/home/rik/.asdf/installs/python/3.10.6/bin/python'
endfunction
function! myspacevim#after() abort
endfunction4. Activate Python 3.10.6 in the shell:
asdf shell python 3.10.65. Install pip package `pynvim` for this Python installation:
pip install pynvim6. Start `nvim` and execute `:echo has("python3")`.
It should output `1`
7. Activate Python 3.10.4 in the shell:
asdf shell python 3.10.48. Start `nvim` and execute `:echo has("python3")`.
It outputs `0`, which is the problem.
----------------
Now to compare it to starting Neovim without Spacevim config:
1. Create a test vimrc file:
# ~/.nvimtest.vim
let g:python3_host_prog = '/home/rik/.asdf/installs/python/3.10.6/bin/python'2. Start Neovim with this RC file:
nvim -u ~/.nvimtest.vim3. Execute `:echo has("python3")`.
Now it should return `1` again. For whichever Python version you activated in the shell with asdf-vm.
Btw, the output of my `:checkhealth` is in all situations the same:
## Python 3 provider (optional)
- INFO: Using: g:python3_host_prog = "/home/rik/.asdf/installs/python/3.10.6/bin/python"
- INFO: Executable: /home/rik/.asdf/installs/python/3.10.6/bin/python
- INFO: Python version: 3.10.6
- INFO: pynvim version: 0.4.3
- OK: Latest pynvim is installed.
Only the `:echo has("python3")` is different between SpaceVim and Neovim, when nvim is started in a shell where an alternative python version was activated with asdf-vm.
And if I enable Denite in `.SpaceVim.d/init.toml`:
[[layers]]
name = "denite"Then this layer is not activated in the shell where `:echo has("python3")` returns `0`. You can check it by checking whether the `:Denite` command is available.
So this seems like a bug in SpaceVim. Or am I missing something?