Youcompleteme: ImportError: No module named ycm_core

Created on 28 Sep 2015  路  19Comments  路  Source: ycm-core/YouCompleteMe

Hi, all:

I install the ycm success:

[ 95%] Building CXX object ycm/CMakeFiles/ycm_client_support.dir/Result.cpp.o
[ 95%] Building CXX object ycm/CMakeFiles/ycm_client_support.dir/Utils.cpp.o
[ 95%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Utils.cpp.o
[ 96%] Building CXX object ycm/CMakeFiles/ycm_client_support.dir/versioning.cpp.o
[ 97%] Building CXX object ycm/CMakeFiles/ycm_core.dir/versioning.cpp.o
[ 98%] Building CXX object ycm/CMakeFiles/ycm_client_support.dir/ycm_client_support.cpp.o
[100%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ycm_core.cpp.o
[100%] Linking CXX shared library /Users/vinllen/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_client_support.so
[100%] Built target ycm_client_support
[100%] Linking CXX shared library /Users/vinllen/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so
[100%] Built target ycm_core
Scanning dependencies of target ycm_support_libs
[100%] Built target ycm_support_libs

Then i add the code into my .vimrc:

let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py'

but it has no effect. When i try to run the .ycm_extra_conf.py, some errors occurs:

Traceback (most recent call last):
  File ".ycm_extra_conf.py", line 32, in <module>
    import ycm_core
ImportError: No module named ycm_core

But the ycm_core was install success at the first compile

Most helpful comment

I use this command can fix this bug
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer

All 19 comments

let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py'

Try moving the global ycm_extra_conf out of the YouCompleteMe folder.

still cannot solve this problem

.ycm_extra_conf.py file is not meant to be directly run. Read the documentation.

I am closing because you did not tell us what you are trying to achieve and the reported issue is not actually an issue.

I use this command can fix this bug
cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer

@broccolii Thanks! Your solution works for me.

@broccolii Thank you very much!

I use this command can fix this bug

I'm trying to understand why people are coming across this. First, of course it isn't a bug. Second, I thought that when this happened we issued a message saying that installation was required.

Are people not getting that message?

@puremourning

Are people not getting that message?

I've been wondering if it just me or is the message not showing. I've just tried making a clean clone of the YCM repo and starting YCM without compiling. As expected the message was not shown anywhere. Actually the message is in stderr, but is not shown unless user explicitly opens the stderr log.

@bstaletic you should get the message as soon as YCM is needed. So if you didn't run the compilation step, after you type a couple of character you should get the error.

@vheon Fair enough. I tried it again, this time typing more than enough characters, using :YcmForceCompileAndDiagnostics and :YcmShowDetailedDiagnostics.

The only message I've got is:

Native filetype completion not supported for current file, cannot force recompilation.

That was after :YcmForceCompileAndDiagnostics. :YcmShowDetailedDiagnostics produced no outpu.

The desired

2016-11-08 20:26:07,798 - ERROR - ycm_core library not detected; you need to compile it by running the build.py script. See the documentation for more details.

was nowhere to be seen, except in the stderr file itself.

@bstaletic And nothing in :messages?

:messages has the desired message, but I am pretty sure I had seen that message without opening :messages. In fact I think I did not know about :messages back then.

@micbou I think we should make the "compile ycmd message" more clear: https://github.com/Valloric/YouCompleteMe/issues/1652#issuecomment-259716341

Ok, the problem is the documentation in Full Installation isn't very clear how to behave with the ./install.sh

I mean: I ve built and compiled as the author of the issue in ycm_build, following the guide, step by step.

Then it says 'you have done', without any reference to ./install.sh, furthermore during install.sh it downloads the libclang which I already download for the installation!
So can you be more detailed in the doc :)

The docs are pretty clear:

Compiling YCM with semantic support for C-family languages:

cd ~/.vim/bundle/YouCompleteMe
./install.py --clang-completer
Compiling YCM without semantic support for C-family languages:

cd ~/.vim/bundle/YouCompleteMe
./install.py
The following additional language support options are available:

C# support: install Mono and add --omnisharp-completer when calling ./install.py.
Go support: install Go and add --gocode-completer when calling ./install.py.
TypeScript support: install Node.js and npm then install the TypeScript SDK with npm install -g typescript.
JavaScript support: install Node.js and npm and add --tern-completer when calling ./install.py.
Rust support: install Rust and add --racer-completer when calling ./install.py.
To simply compile with everything enabled, there's a --all flag. So, to install with all language features, ensure xbuild, go, tsserver, node, npm, rustc, and cargo tools are installed and in your PATH, then simply run:

cd ~/.vim/bundle/YouCompleteMe
./install.py --all
That's it. You're done. Refer to the User Guide section on how to use YCM. Don't forget that if you want the C-family semantic completion engine to work, you will need to provide the compilation flags for your project to YCM. It's all in the User Guide.

Running on 4.13.0-39-generic GNU/Linux

Getting the same error, that the ycm_core cannot be imported.

Ran install.py with --clang-completer flag.

Not really sure what to do. I've rebuilt several times. The error message in the log files says I should run build.py, specifically:

2018-07-06 16:36:21,534 - ERROR - ycm_core library not detected; you need to compile it by running the build.py script. See the documentation for more details

I don't see build.py in ycm's home dir, and I don't see anything about it in the docs...

It's better to open a new thread and provide all the requested info. Or even ask on gitter.
At this point, there's a bunch of stuff that might have gone wrong and we have no information to go from.

Running on 4.13.0-39-generic GNU/Linux

Getting the same error, that the ycm_core cannot be imported.

Ran install.py with --clang-completer flag.

Not really sure what to do. I've rebuilt several times. The error message in the log files says I should run build.py, specifically:

2018-07-06 16:36:21,534 - ERROR - ycm_core library not detected; you need to compile it by running the build.py script. See the documentation for more details

I don't see build.py in ycm's home dir, and I don't see anything about it in the docs...

the same with you , I ran install.py --clang-completer but mentiond ERROR -ycm_core library not detected ......, really troubles me

@sshsu My guess is that you are experiencing this dein issue.

I am locking this thread as the most upvoted answer boils down to following the instructions in the docs which seems common sense to me.

Was this page helpful?
0 / 5 - 0 ratings