New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load python host #2258

Closed
janko-m opened this Issue Mar 26, 2015 · 35 comments

Comments

Projects
None yet
@janko-m

janko-m commented Mar 26, 2015

I wanted to pull in the latest :terminal changes.

$ brew reinstall neovim --HEAD
$ pip install --upgrade neovim

However, when I open Neovim, I get the following error:

Error detected while processing function remote#define#AutocmdBootstrap..remote#host#Require..<SNR>4_RequirePythonHost:                                                              
line   66:                                                                                                                                                                           
E605: Exception not caught: Failed to load python host. Try upgrading the Neovim python module with 'pip install --upgrade neovim' or see ':help nvim-python'.                       
Error detected while processing function remote#define#AutocmdBootstrap..remote#host#Require:                                                                                        
line    6:                                                                                                                                                                           
E171: Missing :endif 

I was able to use Neovim before this update. I'm not using any Python plugins. I still get that error when I comment out my .vimrc.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 26, 2015

Could you try nvim -u NONE and see if you still get the issue?

ghost commented Mar 26, 2015

Could you try nvim -u NONE and see if you still get the issue?

@Shougo

This comment has been minimized.

Show comment
Hide comment
@Shougo

Shougo Mar 26, 2015

Contributor

Please check neovim-python work.

$ python
>>> from neovim import attach
# Create a python API session attached to unix domain socket created above:
>>> nvim = attach('socket', path='/tmp/nvim')
# Now do some work. 
>>> buffer = nvim.buffers[0] # Get the first buffer
>>> buffer[0] = 'replace first line'
>>> buffer[:] = ['replace whole buffer']
>>> nvim.command('vsplit')
>>> nvim.windows[1].width = 10
>>> nvim.vars['global_var'] = [1, 2, 3]
>>> nvim.eval('g:global_var')
[1, 2, 3]
Contributor

Shougo commented Mar 26, 2015

Please check neovim-python work.

$ python
>>> from neovim import attach
# Create a python API session attached to unix domain socket created above:
>>> nvim = attach('socket', path='/tmp/nvim')
# Now do some work. 
>>> buffer = nvim.buffers[0] # Get the first buffer
>>> buffer[0] = 'replace first line'
>>> buffer[:] = ['replace whole buffer']
>>> nvim.command('vsplit')
>>> nvim.windows[1].width = 10
>>> nvim.vars['global_var'] = [1, 2, 3]
>>> nvim.eval('g:global_var')
[1, 2, 3]
@janko-m

This comment has been minimized.

Show comment
Hide comment
@janko-m

janko-m Mar 26, 2015

@Pyrohh I don't get the error with nvim -u NONE.

@Shougo I get an error on nvim = attach('socket', path='/tmp/nvim')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/neovim/__init__.py", line 86, in attach
    socket_session(path) if session_type == 'socket' else
  File "/usr/local/lib/python2.7/site-packages/neovim/msgpack_rpc/__init__.py", line 31, in socket_session
    return session('socket', path)
  File "/usr/local/lib/python2.7/site-packages/neovim/msgpack_rpc/__init__.py", line 17, in session
    loop = EventLoop(transport_type, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/neovim/msgpack_rpc/event_loop/base.py", line 88, in __init__
    getattr(self, '_connect_{0}'.format(transport_type))(*args)
  File "/usr/local/lib/python2.7/site-packages/neovim/msgpack_rpc/event_loop/asyncio.py", line 84, in _connect_socket
    self._loop.run_until_complete(coroutine)
  File "/usr/local/lib/python2.7/site-packages/trollius/base_events.py", line 300, in run_until_complete
    return future.result()
  File "/usr/local/lib/python2.7/site-packages/trollius/futures.py", line 287, in result
    raise self._exception
trollius.py33_exceptions.FileNotFoundError: [Errno 2] No such file or directory

janko-m commented Mar 26, 2015

@Pyrohh I don't get the error with nvim -u NONE.

@Shougo I get an error on nvim = attach('socket', path='/tmp/nvim')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/neovim/__init__.py", line 86, in attach
    socket_session(path) if session_type == 'socket' else
  File "/usr/local/lib/python2.7/site-packages/neovim/msgpack_rpc/__init__.py", line 31, in socket_session
    return session('socket', path)
  File "/usr/local/lib/python2.7/site-packages/neovim/msgpack_rpc/__init__.py", line 17, in session
    loop = EventLoop(transport_type, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/neovim/msgpack_rpc/event_loop/base.py", line 88, in __init__
    getattr(self, '_connect_{0}'.format(transport_type))(*args)
  File "/usr/local/lib/python2.7/site-packages/neovim/msgpack_rpc/event_loop/asyncio.py", line 84, in _connect_socket
    self._loop.run_until_complete(coroutine)
  File "/usr/local/lib/python2.7/site-packages/trollius/base_events.py", line 300, in run_until_complete
    return future.result()
  File "/usr/local/lib/python2.7/site-packages/trollius/futures.py", line 287, in result
    raise self._exception
trollius.py33_exceptions.FileNotFoundError: [Errno 2] No such file or directory
@starcraftman

This comment has been minimized.

Show comment
Hide comment
@starcraftman

starcraftman Mar 27, 2015

I get the same problem as @janko-m. Only on one of my machines. I tried clearing out the broken machine and reinstalling/building from scratch, no change. Removed neovim package and reinstalled too. I get same python message as above & nvim bootstrap error.

On my notebook that I sometimes use to test vim-plug against nvim, python interface works. I don't understand the difference to be honest. Notebook has latest neovim/nvim build too.

I get the same problem as @janko-m. Only on one of my machines. I tried clearing out the broken machine and reinstalling/building from scratch, no change. Removed neovim package and reinstalled too. I get same python message as above & nvim bootstrap error.

On my notebook that I sometimes use to test vim-plug against nvim, python interface works. I don't understand the difference to be honest. Notebook has latest neovim/nvim build too.

@starcraftman

This comment has been minimized.

Show comment
Hide comment
@starcraftman

starcraftman Mar 27, 2015

Found the clear difference: On the machine that works, in the output of ps I see the following entry:
starcra+ 28770 1544 pts/4 0.0 0.2 S Mar26 python -c import neovim; neovim.start_host() /home/starcraftman/programming/github/neovim/inst/share/nvim/runtime/autoload/provider/script_host.py

I don't know why it doesn't start on the other machine as of yet.
Edit: Forgot obvious below for commands. I'll just sit this debug out until a resolution found.

Found the clear difference: On the machine that works, in the output of ps I see the following entry:
starcra+ 28770 1544 pts/4 0.0 0.2 S Mar26 python -c import neovim; neovim.start_host() /home/starcraftman/programming/github/neovim/inst/share/nvim/runtime/autoload/provider/script_host.py

I don't know why it doesn't start on the other machine as of yet.
Edit: Forgot obvious below for commands. I'll just sit this debug out until a resolution found.

@Shougo

This comment has been minimized.

Show comment
Hide comment
@Shougo

Shougo Mar 27, 2015

Contributor

@janko-m Please execute below command before execute python.
NVIM_LISTEN_ADDRESS=/tmp/nvim nvim

Contributor

Shougo commented Mar 27, 2015

@janko-m Please execute below command before execute python.
NVIM_LISTEN_ADDRESS=/tmp/nvim nvim

@janko-m

This comment has been minimized.

Show comment
Hide comment
@janko-m

janko-m Mar 27, 2015

Aha, sorry, didn't realize I have to have Neovim running. I executed all of these commands, and they all work, I just get this error before every command. In general Neovim is working, I just get this error before every cursor movement and command.

janko-m commented Mar 27, 2015

Aha, sorry, didn't realize I have to have Neovim running. I executed all of these commands, and they all work, I just get this error before every command. In general Neovim is working, I just get this error before every cursor movement and command.

@Shougo

This comment has been minimized.

Show comment
Hide comment
@Shougo

Shougo Mar 27, 2015

Contributor

Aha, sorry, didn't realize I have to have Neovim running. I executed all of these commands, and they all work, I just get this error before every command. In general Neovim is working, I just get this error before every cursor movement and command.

Oh, it does not work...
Your nvim binary and vim-python are latest? I think you should reinstall them.

Contributor

Shougo commented Mar 27, 2015

Aha, sorry, didn't realize I have to have Neovim running. I executed all of these commands, and they all work, I just get this error before every command. In general Neovim is working, I just get this error before every cursor movement and command.

Oh, it does not work...
Your nvim binary and vim-python are latest? I think you should reinstall them.

@janko-m

This comment has been minimized.

Show comment
Hide comment
@janko-m

janko-m Mar 27, 2015

I did brew reinstall neovim --HEAD and pip install --upgrade neovim an hour ago. Do I need to do something else? I don't have special vim-python plugin, I'm using Neovim's bulti-in one.

janko-m commented Mar 27, 2015

I did brew reinstall neovim --HEAD and pip install --upgrade neovim an hour ago. Do I need to do something else? I don't have special vim-python plugin, I'm using Neovim's bulti-in one.

@fwalch

This comment has been minimized.

Show comment
Hide comment
@fwalch

fwalch Mar 27, 2015

Member

The only thing I can think of is that it's a problem with different Pythons (e.g. one from Homebrew, one pre-installed), where one has an older version of the neovim client installed. Can you check if pip and python are from the same Python installation? Also see :h g:python_host_prog, might help to set an explicit path to python.

Member

fwalch commented Mar 27, 2015

The only thing I can think of is that it's a problem with different Pythons (e.g. one from Homebrew, one pre-installed), where one has an older version of the neovim client installed. Can you check if pip and python are from the same Python installation? Also see :h g:python_host_prog, might help to set an explicit path to python.

@janko-m

This comment has been minimized.

Show comment
Hide comment
@janko-m

janko-m Mar 27, 2015

$ which pip
/usr/local/bin/pip
$ which python
/usr/local/bin/python
$ python --version
Python 2.7.9
$ pip --version
pip 6.0.8 from /usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg (python 2.7)

It seems like they're both from Homebrew. I tried let g:python_host_prog='/usr/local/bin/python', but I'm still getting the error. I also tried reinstalling Python.

janko-m commented Mar 27, 2015

$ which pip
/usr/local/bin/pip
$ which python
/usr/local/bin/python
$ python --version
Python 2.7.9
$ pip --version
pip 6.0.8 from /usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg (python 2.7)

It seems like they're both from Homebrew. I tried let g:python_host_prog='/usr/local/bin/python', but I'm still getting the error. I also tried reinstalling Python.

@starcraftman

This comment has been minimized.

Show comment
Hide comment
@starcraftman

starcraftman Apr 6, 2015

@janko-m I've got the resolution to this bug!!! It appears to be a local user $HOME file. I made a new user just now to check, & it is bug free. Then I looked in my home for anything with nvim and I found ..nvimrc-rplugin~. I believe this is used by remote plugins & updated with the UpdateRemotePlugins. I forgot I had installed floobits & it was crashing because the plugin was long gone. Deleting the rplugin file makes bug go away.

This might have implications for how nvim handles remotes though. I won't be the first programmer to forget to do that command. Seems neovim should probably prompt a warning.

@tarruda Thoughts?

So I believe to reproduce bug, install any remote (like floobits) and issue UpdateRemotePlugin. Then delete the plugin bundle & restart nvim.

Edit: Some English.

Edit 2: @tarruda Offtopic but why does the file have two leading dots?

@janko-m I've got the resolution to this bug!!! It appears to be a local user $HOME file. I made a new user just now to check, & it is bug free. Then I looked in my home for anything with nvim and I found ..nvimrc-rplugin~. I believe this is used by remote plugins & updated with the UpdateRemotePlugins. I forgot I had installed floobits & it was crashing because the plugin was long gone. Deleting the rplugin file makes bug go away.

This might have implications for how nvim handles remotes though. I won't be the first programmer to forget to do that command. Seems neovim should probably prompt a warning.

@tarruda Thoughts?

So I believe to reproduce bug, install any remote (like floobits) and issue UpdateRemotePlugin. Then delete the plugin bundle & restart nvim.

Edit: Some English.

Edit 2: @tarruda Offtopic but why does the file have two leading dots?

@tarruda tarruda self-assigned this Apr 6, 2015

@janko-m

This comment has been minimized.

Show comment
Hide comment
@janko-m

janko-m Apr 6, 2015

That's it!! I was playing with floobits a month ago, but I totally forgot about it. rm ..nvimrc-rplugin~ solves my problem. Thank you for resolving it!

janko-m commented Apr 6, 2015

That's it!! I was playing with floobits a month ago, but I totally forgot about it. rm ..nvimrc-rplugin~ solves my problem. Thank you for resolving it!

@starcraftman

This comment has been minimized.

Show comment
Hide comment
@starcraftman

starcraftman Apr 6, 2015

@janko-m Even the same plugin eh? Man the simplest things some times!

@janko-m Even the same plugin eh? Man the simplest things some times!

@tarruda

This comment has been minimized.

Show comment
Hide comment
@tarruda

tarruda Apr 6, 2015

Member

@starcraftman thanks for tracking this problem down, hopefully we'll be able to automate the remote plugin setup to reduce the chance of errors like this one

Edit 2: @tarruda Offtopic but why does the file have two leading dots?

It prepends a dot to the filename(.nvimrc)

Member

tarruda commented Apr 6, 2015

@starcraftman thanks for tracking this problem down, hopefully we'll be able to automate the remote plugin setup to reduce the chance of errors like this one

Edit 2: @tarruda Offtopic but why does the file have two leading dots?

It prepends a dot to the filename(.nvimrc)

@starcraftman

This comment has been minimized.

Show comment
Hide comment
@starcraftman

starcraftman Apr 6, 2015

@tarruda Sounds good, is that an active issue being done or on the roadmap?

@tarruda Sounds good, is that an active issue being done or on the roadmap?

@tarruda

This comment has been minimized.

Show comment
Hide comment
@tarruda

tarruda Apr 6, 2015

Member

@tarruda Sounds good, is that an active issue being done or on the roadmap?

My plan is to give the remote plugin infrastructure some attention after the job control/terminal issues are fixed(possibly by the end of the week)

Member

tarruda commented Apr 6, 2015

@tarruda Sounds good, is that an active issue being done or on the roadmap?

My plan is to give the remote plugin infrastructure some attention after the job control/terminal issues are fixed(possibly by the end of the week)

@starcraftman

This comment has been minimized.

Show comment
Hide comment
@starcraftman

starcraftman Apr 7, 2015

@tarruda Ok then, sounds good.

@tarruda Ok then, sounds good.

@tomprince

This comment has been minimized.

Show comment
Hide comment
@tomprince

tomprince May 16, 2015

I think this may be due to this line which always returns an error, even if a suitable python is found. (The autodections logic just below appears to suffer from the same issue).

I think this may be due to this line which always returns an error, even if a suitable python is found. (The autodections logic just below appears to suffer from the same issue).

@Shougo

This comment has been minimized.

Show comment
Hide comment
@Shougo

Shougo May 17, 2015

Contributor

@tomprince The detection routine is changed. So this issue should close and create new issue if the routine does not work. I will check it.

Contributor

Shougo commented May 17, 2015

@tomprince The detection routine is changed. So this issue should close and create new issue if the routine does not work. I will check it.

@ghost ghost closed this May 17, 2015

@justinmk justinmk added the provider label May 17, 2015

@RobAWilkinson

This comment has been minimized.

Show comment
Hide comment
@RobAWilkinson

RobAWilkinson Jun 20, 2015

Thanks for that @starcraftman I had the same issue, deleting the ..nvimrc-rplugin~ fixed things up perfectly

Thanks for that @starcraftman I had the same issue, deleting the ..nvimrc-rplugin~ fixed things up perfectly

@turboMaCk

This comment has been minimized.

Show comment
Hide comment
@turboMaCk

turboMaCk Sep 5, 2015

@janko-m 👍 thanks man

@janko-m 👍 thanks man

@shri3k

This comment has been minimized.

Show comment
Hide comment
@shri3k

shri3k Apr 2, 2016

Doing pip install --upgrade neovim worked for me. Thanks @janko-m

shri3k commented Apr 2, 2016

Doing pip install --upgrade neovim worked for me. Thanks @janko-m

@turboladen

This comment has been minimized.

Show comment
Hide comment
@turboladen

turboladen Apr 9, 2016

FWIW, I have python 2 and 3 installed (via homebrew) and had to pip2 install --upgrade neovim; using pip didn't do the trick.

FWIW, I have python 2 and 3 installed (via homebrew) and had to pip2 install --upgrade neovim; using pip didn't do the trick.

@yoshuawuyts

This comment has been minimized.

Show comment
Hide comment
@yoshuawuyts

yoshuawuyts Apr 16, 2016

This didn't work for me, seems ultisnips users are still running into this SirVer/ultisnips#678

This didn't work for me, seems ultisnips users are still running into this SirVer/ultisnips#678

@wsdjeg

This comment has been minimized.

Show comment
Hide comment
@wsdjeg

wsdjeg Apr 16, 2016

Contributor

I just try with ultisnips,it works well in neovim,but could you have a try with neosnippet? This is a plug-in I use most often

Contributor

wsdjeg commented Apr 16, 2016

I just try with ultisnips,it works well in neovim,but could you have a try with neosnippet? This is a plug-in I use most often

@yoshuawuyts

This comment has been minimized.

Show comment
Hide comment
@yoshuawuyts

yoshuawuyts Apr 17, 2016

@wsdjeg which versions did you use? did you have to resolve anything? Did you already have configuration set up?

I'd try neosnippet, but neosnippet doesn't work with YouCompleteMe.

@wsdjeg which versions did you use? did you have to resolve anything? Did you already have configuration set up?

I'd try neosnippet, but neosnippet doesn't work with YouCompleteMe.

@wsdjeg

This comment has been minimized.

Show comment
Hide comment
@wsdjeg

wsdjeg Apr 17, 2016

Contributor

if you want to use neovim. why not use deoplete + neosnippet?I do not use ycm

Contributor

wsdjeg commented Apr 17, 2016

if you want to use neovim. why not use deoplete + neosnippet?I do not use ycm

@yoshuawuyts

This comment has been minimized.

Show comment
Hide comment
@yoshuawuyts

yoshuawuyts Apr 17, 2016

The issue at hand here is that some ultisnips + YCM users are experiencing this error. I don't think it's desirable to treat packages with 2.3k and 10k respectively as broken on neovim. I'd much rather try out suggestions on how to fix this, and document the solution than simply switch to another package and let someone else run into this sooner rather than later.

The issue at hand here is that some ultisnips + YCM users are experiencing this error. I don't think it's desirable to treat packages with 2.3k and 10k respectively as broken on neovim. I'd much rather try out suggestions on how to fix this, and document the solution than simply switch to another package and let someone else run into this sooner rather than later.

@faceleg

This comment has been minimized.

Show comment
Hide comment
@faceleg

faceleg Apr 27, 2016

@wsdjeg deoplete doesn't work as easily OOTB for typescript (YMMV) which is why I stick with YCM.

@yoshuawuyts I've had luck by:

sudo pip uninstall neovim
sudo pip install neovim

faceleg commented Apr 27, 2016

@wsdjeg deoplete doesn't work as easily OOTB for typescript (YMMV) which is why I stick with YCM.

@yoshuawuyts I've had luck by:

sudo pip uninstall neovim
sudo pip install neovim
@xanderdunn

This comment has been minimized.

Show comment
Hide comment
@xanderdunn

xanderdunn May 12, 2016

@faceleg's uninstall and install also solved this for me.

@faceleg's uninstall and install also solved this for me.

@themightyoarfish

This comment has been minimized.

Show comment
Hide comment
@themightyoarfish

themightyoarfish Jun 13, 2016

On my system, a fresh install of neovim and the python package leads to this error still, unless I start it with -u NONE. None of the solutions here apply or work for me.
OSX 10.10.5, current master, python 2.7

On my system, a fresh install of neovim and the python package leads to this error still, unless I start it with -u NONE. None of the solutions here apply or work for me.
OSX 10.10.5, current master, python 2.7

@steadystatic

This comment has been minimized.

Show comment
Hide comment
@steadystatic

steadystatic Jun 15, 2016

@themightyoarfish I had the same version of python via brew...but after checking ~/.nvimlog I saw Python 3 mentioned...so running:

pip3 install --upgrade --force-reinstall neovim

resolved it for me.

@themightyoarfish I had the same version of python via brew...but after checking ~/.nvimlog I saw Python 3 mentioned...so running:

pip3 install --upgrade --force-reinstall neovim

resolved it for me.

@themightyoarfish

This comment has been minimized.

Show comment
Hide comment
@themightyoarfish

themightyoarfish Jun 15, 2016

Turns out my problem was that PYTHONPATH was set so python 3 tried to load the python 2 neovim module.

Turns out my problem was that PYTHONPATH was set so python 3 tried to load the python 2 neovim module.

@weaming

This comment has been minimized.

Show comment
Hide comment
@weaming

weaming Mar 3, 2018

When editing python file this issue shows up.

My solution is replacing:

    let g:python_host_prog = '$HOME/anaconda3/envs/python2/bin/python2.7'
    let g:python3_host_prog = '$HOME/anaconda3/bin/python3.6'

with

    let g:python_host_prog = '/Users/weaming/anaconda3/envs/python2/bin/python2.7'
    let g:python3_host_prog = '/Users/weaming/anaconda3/bin/python3.6'

Maybe pymode plugin could not get along with the $HOME variable well.

weaming commented Mar 3, 2018

When editing python file this issue shows up.

My solution is replacing:

    let g:python_host_prog = '$HOME/anaconda3/envs/python2/bin/python2.7'
    let g:python3_host_prog = '$HOME/anaconda3/bin/python3.6'

with

    let g:python_host_prog = '/Users/weaming/anaconda3/envs/python2/bin/python2.7'
    let g:python3_host_prog = '/Users/weaming/anaconda3/bin/python3.6'

Maybe pymode plugin could not get along with the $HOME variable well.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment