3

I use Linux CentOS-7-x86_64 and am trying to install YouCompleteMe with vundle. I get the error:

YouCompleteMe unavailable: unable to load Python.

however, when I type vim --version I get:

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 13 2020 22:48:56)
Included patches: 1-577
Compiled by louqinjian@localhost.localdomain
Huge version without GUI.  Features included (+) or not (-):
+acl               -farsi             +mouse_sgr         +tag_binary
+arabic            +file_in_path      -mouse_sysmouse    -tag_old_static
+autocmd           +find_in_path      +mouse_urxvt       -tag_any_white
+autochdir         +float             +mouse_xterm       -tcl
-autoservername    +folding           +multi_byte        +termguicolors
-balloon_eval      -footer            +multi_lang        +terminal
+balloon_eval_term +fork()            -mzscheme          +terminfo
-browse            +gettext           +netbeans_intg     +termresponse
++builtin_terms    -hangul_input      +num64             +textobjects
+byte_offset       +iconv             +packages          +textprop
+channel           +insert_expand     +path_extra        +timers
+cindent           +ipv6              +perl              +title
-clientserver      +job               +persistent_undo   -toolbar
-clipboard         +jumplist          +popupwin          +user_commands
+cmdline_compl     +keymap            +postscript        +vartabs
+cmdline_hist      +lambda            +printer           +vertsplit
+cmdline_info      +langmap           +profile           +virtualedit
+comments          +libcall           +python/dyn        +visual
+conceal           +linebreak         +python3/dyn       +visualextra
+cryptv            +lispindent        +quickfix          +viminfo
+cscope            +listcmds          +reltime           +vreplace
+cursorbind        +localmap          +rightleft         +wildignore
+cursorshape       +lua               +ruby              +wildmenu
+dialog_con        +menu              +scrollbind        +windows
+diff              +mksession         +signs             +writebackup
+digraphs          +modify_fname      +smartindent       -X11
-dnd               +mouse             -sound             -xfontset
-ebcdic            -mouseshape        +spell             -xim
+emacs_tags        +mouse_dec         +startuptime       -xpm
+eval              -mouse_gpm         +statusline        -xsmp
+ex_extra          -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+extra_search      +mouse_netterm     +syntax            -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -std=gnu99 -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc -std=gnu99   -L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE   -L/usr/local/lib -Wl,--as-needed -o vim        -lm -ltinfo  -lselinux   -ldl  -L/usr/lib -llua -Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE  -fstack-protector  -L/usr/lib64/perl5/CORE -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc    -lruby -lpthread -lrt -ldl -lcrypt -lm  

And, when I install vim with .configure, I include

--with-features=huge --enable-python3interp --enable-pythoninterp

What can I do to solve this?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
AlphaNotKnows
  • 31
  • 1
  • 2

4 Answers4

3

I suggest you go to your ~/.vimrc and add this at the beginning of the file BEFORE you begin your Plug declarations.

if has('python3')
endif

Example of ~/.vimrc:

if has('python3')
endif

call plug#begin('~/.vim/plugged')
Plug 'https://github.com/ycm-core/YouCompleteMe.git'
call plug#end

From there you can

:PlugInstall 

it and then cd into your YouCompleteMe directory. If you have Anaconda installed make sure you DON'T install it with it.

Use your /usr/bin python instead.

Example:

/usr/bin/python3 install.py --all

Finally, once it's all set and done reboot your computer and open up Vim again.

I installed YouCompleteMe using https://github.com/junegunn/vim-plug but as long as you have that 'if' statement in your vimrc it should work.

2

Maybe it's because your VIM is using python 2.* as default python version. From 2020, YouCompleteMe dropped support for python 2.

:python import sys; print(sys.version)

Run this command inside your vim to see which version of python are in used.

Zed
  • 31
  • 4
1

recompile as the instruments here. everything works fine.

(many thanks to the man who shared his solution)

./configure --with-features=huge
--enable-multibyte
--enable-gtk3-check
--enable-rubyinterp=yes
--with-python3-command=python3.7
--enable-python3interp=yes
--enable-perlinterp=yes
--enable-luainterp=yes
--enable-cscope

see more details here: https://github.com/ycm-core/YouCompleteMe/issues/3635

Reagen
  • 21
  • 5
1

remove the configuration of python2:

--enable-pythoninterp,(remove this words)

because YouCompleteMe dropped support for python2.

chen yaoyi
  • 11
  • 3
  • like this : --with-features=huge --enable-python3interp – chen yaoyi Oct 14 '21 at 06:54
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 14 '21 at 07:27
  • As a related question, if I change this in my make config, can I then make install again without uninstalling? – Connor May 11 '23 at 21:30