simnalamburt / vim-mundo

:christmas_tree: Vim undo tree visualizer
https://simnalamburt.github.io/vim-mundo
GNU General Public License v2.0
791 stars 28 forks source link

Failed to load python host #106

Closed benzanol closed 3 years ago

benzanol commented 3 years ago

When I try to open the Mundo window, I get the error Failed to load python host. You can try to see what happened by starting nvim with $NVIM_PYTHON_LOG_FILE set and opening the generated log file. Also, the host stderr is available in messages. I tried setting $NVIM_PYTHON_LOG_FILE, but the file remains empty. I also tried creating a completely blank config with nothing but Mundo to make sure nothing I had was conflicting with it, as well as reinstalling the plugin, but I get the same error.

simnalamburt commented 3 years ago

image

Sorry I failed to reproduce your error. I just tried mundo with nvim and it worked fine. May I ask your development environment information to reproduce this error?

For example, this is my environment:

$ uname -a
Linux redacted 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 x86_64 GNU/Linux

$ cat /etc/issue
Debian GNU/Linux 10 \n \l

$ nvim --version | head -n3
NVIM v0.4.4
Build type: RelWithDebInfo
LuaJIT 2.0.5

$ python3 --version
Python 3.7.3

$ python3 -m pip show pynvim | head -n2
Name: pynvim
Version: 0.4.2
benzanol commented 3 years ago

Hi, thanks for the quick response. Here's the information you asked for

$uname -a
Linux localhost.localdomain 5.8.15-301.fc33.x86_64 #1 SMP Thu Oct 15 16:58:06 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

OS: Fedora 33

$ cat /etc/issue
\S
Kernel \r on an \m (\l)

$ nvim --version | head -n3
NVIM v0.4.4
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

$ python3 --version
python 3.9.0

Running python3 -m pip show pynvim | head -n2 I get this error message
Name: pynvim
Version: 0.4.2
ERROR: Pipe to stdout was broken
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe

I also realized when testing a few things that if I use the -u flag when opening nvim Mundo opens and functions just fine, even if I specify the path to the default init.vim file. So if nothing else I can just lias nvim to have the flag specified in my bashrc.

simnalamburt commented 3 years ago

This is weird. Our nvim and pynvim version is same. Do other neovim plugins with python extensions works fine? I think this is an issue of neovim not this plugin.

benzanol commented 3 years ago

I don't know of any other plugins that I use that use python, so it probably is a neovim issue. For now it works fine if I jus alias nvim to nvim - u [config path] so I will just stick to that.

dsummersl commented 3 years ago

Can you run :checkhealth and verify that you have a python3 provider configured?

benzanol commented 3 years ago

Yes, the python3 host is installed.

## Python 3 provider (optional)
  - INFO: Multiple python3 executables found.  Set `g:python3_host_prog` to avoid surprises.
  - INFO: Executable: /usr/bin/python3
  - INFO: Other python executable: /bin/python3
  - INFO: Python version: 3.8.5
  - INFO: pynvim version: 0.4.2
  - OK: Latest pynvim is installed.
ruffson commented 3 years ago

I have the same problem. I am on Fedora as well and use miniconda but I tried it without the virtualenv from conda with the system python.

This is the error when I try to toggle:

function mundo#MundoToggle[1]..<SNR>141_MundoToggle[4]..<SNR>141_MundoOpen[11]..<SNR>141_MundoSet
upPythonPath[3]..<SNR>141_MundoPython[1]..provider#python#Call[9]..remote#host#Require[10]..provi
der#pythonx#Require[13]..provider#Poll, line 4
Vim(if):Error invoking 'poll' on channel 8:^@ch 8 was closed by the client
Failed to load python host. You can try to see what happened by starting nvim with $NVIM_PYTHON_L
OG_FILE set and opening the generated log file. Also, the host stderr is available in messages.
Press ENTER or type command to continue

I also tried setting that var but nothing was written (I am using fish but tried with bash as well).

❯ uname -a
Linux redacted 5.10.16-200.fc33.x86_64 #1 SMP Sun Feb 14 03:02:32 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

~
❯ cat /etc/issue
\S
Kernel \r on an \m (\l)

~
❯ nvim --version | head -n3
NVIM v0.4.4
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

~
❯ python3 --version
Python 3.8.5

~
❯ python3 -m pip show pynvim | head -n2

Name: pynvim
Version: 0.4.2
ERROR: Pipe to stdout was broken
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe

And when I do checkhealth, the python3 provider is:

## Python 3 provider (optional)
  - INFO: Using: g:python3_host_prog = "/usr/bin/python3"
  - INFO: Executable: /usr/bin/python3
  - INFO: Python version: 3.9.1
  - INFO: pynvim version: 0.4.2
  - OK: Latest pynvim is installed.

In my init.vim I set my undodir to be in the default nvim dir, could that be it?

set undofile " Maintain undo history between sessions
set undodir=~/.local/share/nvim/undo

I am also using the thaerkh/vim-workspace plugin with this config, but afaik this should not collide.

let g:workspace_session_directory = $home . '/.local/share/nvim/sessions/'
let g:workspace_session_disable_on_args = 1
let g:workspace_persist_undo_history = 0
let g:workspace_autosave = 0
simnalamburt commented 3 years ago

It is unlikely that vim-mundo is the cause of the Python load failure. This is most likely caused by the compilation flags of your vim distribution.

ruffson commented 3 years ago

It is unlikely that vim-mundo is the cause of the Python load failure. This is most likely caused by the compilation flags of your vim distribution.

Okay, too bad then.

macthecadillac commented 3 years ago

After digging around in my configuration, the culprit is g:python_host_prog. I guess if your system doesn't have python2 installed then that gets in the way.