This is just a note for anybody who might be having the same issue.
I have Anaconda Python installed and the PATH is changed so that that is my default python interpreter. YCM cannot work. I just got server shutdown message, there is no debug or log information that I could get. However, after randomly trying to explicitly set the python interpreter of YCM to the system one, it started working again:
let g:ycm_path_to_python_interpreter = '/usr/bin/python'
Only the official Python distributions are supported. Thank you for reporting this though; hopefully it will help people searching on Google.
This helped me, thank you.
Ah yes, fix works. Thanks.
NOTE: When compiling YCM, ensure that 'which python' is pointing to /usr/bin/python as well.
Not working anymore.
Using latest macvim, YMC.
First compile YMC with default python /usr/bin/python (2.7.10), setting the let g:ycm_path_to_python_interpreter = '/usr/bin/python'. MacVim with YCM works.
Second I add anaconda to $PATH. It failed.
YCM was working for me until I installed anaconda2 (which comes with python). Vim wouldn't load at all (would get Vim: Caught deadly signal ABRT error). I tried the suggestion at the beginning (let g:ycm_path_to_python_interpreter = '/usr/bin/python' in my .vimrc) but it didn't work.
As anaconda adds export PATH="~/anaconda2/bin:$PATH" to .bash_profile in Mac (or to .bashrc in Linux), what worked for me was to delete this line from my .bash_profile and added instead export PATH="/usr/local/bin:$PATH". Your default python version should be now the one installed in usr/local/bin/ and not in ~/anaconda2/bin (you can double check with $ which python).
After this I just compiled YCM again, and it started working again.
I tried the suggestion at the beginning (let g:ycm_path_to_python_interpreter = '/usr/bin/python' in my .vimrc) but it didn't work.
We have to separate the errors:
Vim: Caught deadly signal ABRT error: That is vim crashing because we're using a python that is different from the one vim was compiled against.ycmd (the YCM server) which is not able to run with whatever version of python you have as default.Using the g:ycm_path_to_python_interpreter variable is useful only for the second kind of error.
I was able to get ycm to compile with anaconda. Anaconda's libpython3.5m.dylib uses relative paths instead of absolute paths (on OSX). See https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/fUpqjkK5jEI
First make macvim and ycm compile with the anaconda interpreter. Then I used the following:
install_name_tool -change libpython3.5m.dylib /path/to/anaconda3/lib/libpython3.5m.dylib ~/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so
@damca, I use miniconda2, that makes no different with anaconda. But I get errors like this
Traceback (most recent call last):
File "<string>", line 19, in <module>
Press ENTER or type command to continue
File "/Users/Yefee/.vim/bundle/YouCompleteMe/autoload/../python/ycm/setup.py", line 37, in SetUpSystemPaths
Press ENTER or type command to continue
from ycmd import server_utils as su
Press ENTER or type command to continue
File "/Users/Yefee/.vim/bundle/YouCompleteMe/python/ycm/../../third_party/ycmd/ycmd/server_utils.py", line 25, in <module>
Press ENTER or type command to continue
import io
Press ENTER or type command to continue
File "/Users/Yefee/miniconda2/lib/python2.7/io.py", line 51, in <module>
Press ENTER or type command to continue
import _io
Press ENTER or type command to continue
ImportError: dlopen(/Users/Yefee/miniconda2/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
Press ENTER or type command to continue
Referenced from: /Users/Yefee/miniconda2/lib/python2.7/lib-dynload/_io.so
Press ENTER or type command to continue
Expected in: flat namespace
Press ENTER or type command to continue
in /Users/Yefee/miniconda2/lib/python2.7/lib-dynload/_io.so
Press ENTER or type command to continue
YouCompleteMe unavailable: dlopen(/Users/Yefee/miniconda2/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /Users/Yefee/miniconda2/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /Users/Yefee/miniconda2/lib/python2.7/lib-dynload/_io.so
The solution does not help. Do you have any suggestions?
I've had success using YouCompleteMe under the Linux Subsystem in Windows 10 Insider Preview like this:
Plugin 'Valloric/YouCompleteMe' to your ~/.vimrc):PluginInstall, wait for it to complete (takes a while). When it finishes, close vim.~/.vim/bundle/YouCompleteMe/install.py from inside the YouCompleteMe directory; it will fail. Remember the Python library and include paths, these paths are required in the next step.-DPYTHON_LIBRARY=/home/fredrikb/anaconda3/lib/libpython3.5m.so and-DPYTHON_INCLUDE_DIR=/home/fredrikb/anaconda3/include/~/.vim/bundle/YouCompleteMe/third_party/ycm/cpp/. If there is a CMakeCache.txt, delete it.cmake -G "Unix Makefiles" -DPYTHON_LIBRARY=/home/fredrikb/anaconda3/lib/libpython3.5m.so -DPYTHON_INCLUDE_DIR=/home/fredrikb/anaconda3/include/ -DUSE_PYTHON2=OFF, then run make. *.py file to verify that YouCompleteMe now works.@boulund
Thanks for your detailed response! It seems my version is not exactly as yours. I can install the plugin, but when I start vim it shows the error message as above.
Thanks!
CF
Python Requests HTTPConnectionPool and Max retries exceeded with url
If you have recently installed Anaconda, and when you start your MacVim and find out that it doesn't work anymore. When you run YcmToggleLogs [log file name] in vim, if you get the above error message, this issue is going to help you a lot. Please read this whole post carefully.
I have encountered this problem yesterday, and I spent a WHOLE DAY searching for the error message, but in vain, until I accidentally tried to search anaconda and YCM. I was lucky, but I would like to build any possible relations between that specific error message I got and YCM to save other poor guys' time, in hope that Google will help them help here well.
Finger crossed.
Workaround for Anaconda/Miniconda + YouCompleteMe users (Those who are getting server shutdown errors). Here is how I fixed it (Tested on Mac using Macvim and ubuntu 16.06 using vim).
Make sure all the environment variables in ~/,bashrc, ~/.bash_profile, ~/.profile point to the default python in /usr/bin/python and not the anaconda / miniconda versions. Double check by printing echo $PATH [You must NOT find anything with *conda*].
Delete the directory ~/.vim/bundle/YouCompleteMe
Re-install the plugin by adding the following lines to ~/.vimrc - Plugin 'Valloric/YouCompleteMe'
Do a :PluginInstall 'Valloric/YouCompleteMe'
Goto ~/.vim/bundle/YouCompleteMe/ and do python install.py.
Done !! Open any sample python file with vim, code completion should now work.
Change the environment variables PYTHONPATH or PYTHON3_PATH to point to your anaconda/miniconda python in ~/,bashrc, ~/.bash_profile, ~/.profile. The code completion still works.
Thanks
An alternative, specify the PATH variable explicitly for vim using an alias, e.g.,
alias vim='PATH=/usr/bin vim'
I had the same issue. For me worked even simpler solution. I haven't changed any env variables, etc. I've just run the YCM installer using default python. After this - no longer "server restart" message :)
cd ~/.vim/bundle/YouCompleteMe
/usr/bin/python install.py
@k-lyda Yes, that should work for everyone, as it's just building with the system's python and is what we test, support and claim to work. With that and considering there's an FAQ entry about this, I'll lock this thread.
Most helpful comment
Workaround for Anaconda/Miniconda + YouCompleteMe users (Those who are getting server shutdown errors). Here is how I fixed it (Tested on Mac using Macvim and ubuntu 16.06 using vim).
Make sure all the environment variables in
~/,bashrc,~/.bash_profile,~/.profilepoint to the default python in/usr/bin/pythonand not the anaconda / miniconda versions. Double check by printingecho $PATH[You must NOT find anything with *conda*].Delete the directory
~/.vim/bundle/YouCompleteMeRe-install the plugin by adding the following lines to
~/.vimrc-Plugin 'Valloric/YouCompleteMe'Do a
:PluginInstall 'Valloric/YouCompleteMe'Goto
~/.vim/bundle/YouCompleteMe/and dopython install.py.Done !! Open any sample python file with vim, code completion should now work.
Change the environment variables
PYTHONPATHorPYTHON3_PATHto point to your anaconda/miniconda python in~/,bashrc,~/.bash_profile,~/.profile. The code completion still works.Thanks