Youcompleteme: Error on start - youcompleteme#Enable..<SNR>140_SetUpPython:

Created on 14 Dec 2014  路  18Comments  路  Source: ycm-core/YouCompleteMe

OSX v 10.10.1
xcode command line tools are installed
vim & mvim 7.4

I get the error when starting vim regardless if I:

  1. Remove homebrew's python or not (confirming path and python -v are indeed changed)
  2. Use macvim or not
  3. Use the install script or run 'cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp'
  4. Using system boost or not.
  5. edit the build.sh to point to system or homebrew's python headers and libs.
Error detected while processing function youcompleteme#Enable..<SNR>140_SetUpPython:
line   27:
Traceback (most recent call last):
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>140_SetUpPython:
line   27:
  File "<string>", line 1, in <module>
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>140_SetUpPython:
line   27:
  File "/Users/denniswalker/.vim/bundle/YouCompleteMe/autoload/../python/ycm/youcompleteme.py", line 97, in __init__
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>140_SetUpPython:
line   27:
    self._SetupServer()
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>140_SetUpPython:
line   27:
  File "/Users/denniswalker/.vim/bundle/YouCompleteMe/autoload/../python/ycm/youcompleteme.py", line 132, in _SetupServer
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>140_SetUpPython:
line   27:
    self._server_popen = utils.SafePopen( args, stdout = PIPE, stderr = PIPE)
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>140_SetUpPython:
line   27:
  File "/Users/denniswalker/.vim/bundle/YouCompleteMe/autoload/../third_party/ycmd/ycmd/utils.py", line 242, in SafePopen

Most helpful comment

brew uninstall vim 
brew install vim --build-from-source

This works for me

All 18 comments

Your traceback isn't complete. It's impossible to see what seems to be the case. Take a look at ycmd's logs.

I'm getting this same error in OS X 10.9.5, Vim 7.4.
:messages output:

Messages maintainer: Bram Moolenaar <[email protected]>
Error detected while processing function youcompleteme#Enable..<SNR>56_SetUpPython:
line    6:
Traceback (most recent call last):
Error detected while processing function youcompleteme#Enable..<SNR>56_SetUpPython:
line    6:
  File "<string>", line 1, in <module>
Error detected while processing function youcompleteme#Enable..<SNR>56_SetUpPython:
line    6:
  File "/Users/r627826/.dotfiles/vim/bundle/YouCompleteMe/autoload/../third_party/ycmd/ycmd/utils.py", line 20, in <module>
Error detected while processing function youcompleteme#Enable..<SNR>56_SetUpPython:
line    6:
    import tempfile
Error detected while processing function youcompleteme#Enable..<SNR>56_SetUpPython:
line    6:
ImportError: No module named tempfile

:YcmDebugInfo:

Printing YouCompleteMe debug information...
Error detected while processing function <SNR>56_DebugInfo:
line    2:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'ycm_state' is not defined
E858: Eval did not return a valid python object
-- 0

I'm honestly not sure how to get a full traceback, and I haven't seen anything in the documentation about it. As far as I can tell, log files aren't being written to, and I haven't managed to get logs sent to stdout. I tried running:

vim --cmd "let g:ycm_server_use_vim_stdout = 1" --cmd "let g:ycm_server_log_level = 'debug'"

But it doesn't change the amount of output I get from the plugin.

I managed to solve this on my own by doing a little investigating. I was using system Python when called from the command line (/usr/bin/python), but it looks like YCM was using Homebrew python. I removed the Homebrew versions and YCM loaded fine.

@steeef For future reference: Even if the output inside vim do not change, YCM should print to the log file and there you can infer more things.

I couldn't figure out where YCM was logging to, and :YcmDebugInfo was no help, as you can see above.

@steeef YCM log into whatever python temp directory is, so if you don't know where it is do this:

start python, and then:

import tempfile
tempfile.gettempdir()

It will print the temp directory, inside that there's a directory called ycm_temp and there you will find the stdout and stderr of the server.

Glad you got it figured out.

I got this exact same issue after doing an install of ROS.

For some reason a script somewhere, (rosdep maybe?) pulls in homebrew python even though I try to stay away from it. I like to use the system python.

Anyway I'm posting this for anyone else that may come here with this same issue to always check for your python version and do a brew uninstall python to get rid of homebrew python.

My new vim env also run into this issue. And I found it is because Vundle didn't install YouCompleteMe correctly. After I manually run "git submodule update --init --recursive", the issue is gone.

executing the following solved it for me:
git submodule update --init --recursive

Same issue, and the git submodule update --init --recursive fixed this.
I had aborted the Vundle YCM installation after it hung for about 5 minutes at "Processing YouCompleteMe"; something seems to be wrong with the vundle installation of YCM.
Using:
Ubuntu 15.04
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 9 2014 17:36:40)
Included patches: 1-488
Official LLVM binaries, version 3.6.2

For anyone else running into this issue, the git submodule update --init --recursive must be run in the YouCompleteMe directory. If you installed the plugin using the steps in the installation guide, this should be: ~/.vim/bundle/YouCompleteMe

Like @spaghetti- I am also a ROS user, but I rely on homebrew python for several reasons. I have the same issue as referenced when I install MacVim from binaries. However, building from source (e.g. via homebrew) works fine. I'm guessing this links MacVim to the correct python installation in some way.

Anyone know how to have brew python installed without triggering this issue?

+1 @gkop

I also need to have python installed via brew. It is unclear how I do this with YouCompleteMe.

This is confusing/frustrating, as this seemed to work fine in the past.

Removing and re-installing vim did the trick for me (just if anyone else comes here with the same problem). :)

brew uninstall vim 
brew install vim --build-from-source

This works for me

My vim today showed the same problem with you guys(my OS version : 10.13.4) and my friend Gua told me that this situation might result from python's incorrect version(that's the key point) and as we all know that the python version in mac is quite complex so here i strongly recommendpyenv for your version management. Then I found there is a brand new version of python under my brew list was 3.7.0 and I removed it, now my python version is 3.5.2 in brew list(Yeh I don't know why i got two version) and YCM works fine under this version, so actually I think that most of you don't get the right way of your python for YCM, please be patient and concentrated try to make some differences on this problem. Also@vheon I agree with you if we could get YCM logged we can easily figure out where the problem is.

This may be related to https://github.com/powerline/powerline/issues/1925 (it's a problem with Vim)

Was this page helpful?
0 / 5 - 0 ratings