Youcompleteme: Trying to install YCM for hours, unsuccessfully.

Created on 28 Jul 2015  路  26Comments  路  Source: ycm-core/YouCompleteMe

I'm on Yosemite, MacVim version 7.4 compiled from source(not homebrew), works fine.
I'm using cmake version 3.3.0, installed using Homebrew.

  1. Installed YCM using vundle.
  2. Created ycm_build directory, cd into it.
  3. cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
-- The C compiler identification is AppleClang 6.1.0.6020053
-- The CXX compiler identification is AppleClang 6.1.0.6020053
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Your C++ compiler supports C++11, compiling in that mode.
-- Found PythonLibs: /usr/lib/libpython2.7.dylib (found suitable version "2.7.6", minimum required is "2.6")
-- Found PythonInterp: /usr/bin/python2.6 (found suitable version "2.6.9", minimum required is "2.6")
NOT using libclang, no semantic completion for C/C++/ObjC will be available
-- Found PythonInterp: /usr/bin/python2.6 (found version "2.6.9")
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/javi/ycm_build

Then I run:

$ make ycm_support_libs
...

And upon starting Vim, this is what I see:

Error detected while processing function youcompleteme#Enable..<SNR>63_SetUpPython:
line   34:
Traceback (most recent call last):
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>63_SetUpPython:
line   34:
  File "<string>", line 25, in <module>
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>63_SetUpPython:
line   34:
  File "/Users/javi/GoogleDrive/dotfiles/vim/bundle/YouCompleteMe/autoload/../third_party/ycmd/ycmd/utils.py", line 277, in SafePo
pen
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>63_SetUpPython:
line   34:
    return subprocess.Popen( *args, **kwargs )
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>63_SetUpPython:
line   34:
  File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __in
it__
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>63_SetUpPython:
line   34:
    errread, errwrite)
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>63_SetUpPython:
line   34:
  File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _ex
ecute_child
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>63_SetUpPython:
line   34:
    raise child_exception
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>63_SetUpPython:
line   34:
OSError: [Errno 2] No such file or directory
Press ENTER or type command to continue

Something to do with Python, which I have installed using Homebrew. I know it has something to do with the output of cmake:

...
-- Found PythonLibs: /usr/lib/libpython2.7.dylib (found suitable version "2.7.6", minimum required is "2.6")
-- Found PythonInterp: /usr/bin/python2.6 (found suitable version "2.6.9", minimum required is "2.6")
NOT using libclang, no semantic completion for C/C++/ObjC will be available
-- Found PythonInterp: /usr/bin/python2.6 (found version "2.6.9")
...

But don't know exactly how to fix it. Any help will be wellcome.

Most helpful comment

I meet this problem before. It is the wrong path to Python which is not I set in YCM building. May sure there's only one Python interpreter on you mac, or you can set the right path to Python by g:ycm_path_to_python_interpreter

All 26 comments

Try to unlink the brewed python, reinstall YCM through the ./install.sh script and then after reinstall the brewed python.

All right, I did:

$ brew uninstall python
$ brew update

Reinstall YCM:

  1. deleted the plugin.
  2. :PluginInstall
  3. And finally:
$ cd ~/.vim/bundle/YouCompleteMe
$ ./install.sh

When running vim, this is the result:

Error detected while processing /Users/javi/.vim/bundle/YouCompleteMe/autoload/youcompleteme.vim:
line  674:
E887: Sorry, this command is disabled, the Python's site module could not be loaded.
Press ENTER or type command to continue

Error detected while processing function youcompleteme#Enable..<SNR>63_SetUpPython:
line   34:
E887: Sorry, this command is disabled, the Python's site module could not be loaded.
Press ENTER or type command to continue

Only two errors, we're getting closer.

is it just MacVim or terminal vim as well?

I hadn't used the gui version, but now that you've mentioned it, I've tried it, and the error messages are identical.

looks like there's still something wrong with you're python. Are you sure you've unbrewed correctly? Look https://github.com/Valloric/YouCompleteMe/issues/8#issuecomment-34374807 and the rest of the issue for other tips.

brew uninstall python, there's no much more I can do, or is there? As to my python:

$ python --version
Python 2.7.6
$ which python
/usr/bin/python

Abouth #8 (comment) I've read it about 4 times today, and it's a mess of contradictory theories, solutions and whatnots, if you could give me more concrete instructions, I would be grateful.
As I said in the first comment, I think the problem is in the output of cmake:

...
-- Found PythonLibs: /usr/lib/libpython2.7.dylib (found suitable version "2.7.6", minimum required is "2.6")
-- Found PythonInterp: /usr/bin/python2.6 (found suitable version "2.6.9", minimum required is "2.6")
NOT using libclang, no semantic completion for C/C++/ObjC will be available
-- Found PythonInterp: /usr/bin/python2.6 (found version "2.6.9")
...

There's a contradiction between the version of the PythonLibs, and the PythonInterp, 2.7 and 2.6 respectively. A friend told me he had the same problem and he solved it passing some options to cmake but he didn't tell me which ones.
How can I pass the PythonInterp option? That could help...

if you could give me more concrete instructions, I would be grateful.

I can't because I've never experience any problem installing YCM since the first day I tried, sorry.

Regarding the flags, check the the https://github.com/Valloric/ycmd/blob/master/build.py

You didn't experience any issue installing YCM? I have a fresh install of Yosemite, I wasn't even using Homebrew, I just installed it because the README requires it for installing Cmake.
What am I supossed to do with that file? What flags?

That file is what builds ycmd and there you should see what flags you can pass.

Should I? What a flag looks like?

There is an env variable EXTRA_CMAKE_ARGS which the script will read and pass its content to cmake.

As neverpanic mentions in issue number 8, there are two flags to be passed to the compiler(Cmake) -DPYTHON_LIBRARY and -DPYTHON_INCLUDE_DIR, in case the install.sh script don't get it right, which in my case looks like it didn't. Does anyone know what values pass to this options, and where to get these values? Thanks.

I guess you should ask over there since this is really a configuration problem and not a YCM bug.

Well, that issue is pretty old and messy. Not everybody has the time to read it through, like I did a couple of times. There's good advice in it, and a lot of noise too. That's why I decided to open a new issue, it maybe helpful for users in my situation. I don't know but, why did you close this issue?

I'll quote myself:

this is really a configuration problem and not a YCM bug

Who's saying it's a bug? I'm not. An issue is not a but, is it? I'm just trying to get some help for installing the YCM plugin, I'll quote myself:
As neverpanic mentions in issue number 8, there are two flags to be passed to the compiler(Cmake) - DPYTHON_LIBRARY and -DPYTHON_INCLUDE_DIR, in case the install.sh script don't get it right, which in my case looks like it didn't. Does anyone know what values pass to this options, and where to get these values? Thanks.

Then you should look at the first paragraph in CONTRIBUTING.md:

First things first: the issue tracker is NOT for tech support. It is for reporting bugs and requesting features. If your issue amounts to "I can't get YCM to work on my machine" and the reason why is obviously related to your machine configuration and the problem would not be resolved with reasonable changes to the YCM codebase, then the issue is likely to be closed.

Oh all right then, I hadn't read that. Thanks?

I meet this problem before. It is the wrong path to Python which is not I set in YCM building. May sure there's only one Python interpreter on you mac, or you can set the right path to Python by g:ycm_path_to_python_interpreter

Reinstalling vim/macvim with homebrew using fixed this issue for me.

I never use homebrew. So never have such issues. But glad that you solved it.

Just encountered this issue as well - uninstalling vim/macvim via brew as @mkolodny mentioned fixed it for me too.

uninstall was not a solution in my case, vim complained at the very beginning, that is not finding python support
I did the following:
cd /usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/
mv _io.so _io.so.orig
cp /usr/lib/python2.7/lib-dynload/_io.so ./

( I've built vim8 from source - from github.com/vim/vim.git
./configure --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config/
make
sudo make install)

@Rhonin1220 That's the answer!

@Rhonin1220 Thanks!

@Rhonin1220 Works, thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings