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 [email protected]
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?
4
Answers
Maybe it’s because your VIM is using python 2.* as default python version. From 2020, YouCompleteMe dropped support for python 2.
Run this command inside your vim to see which version of python are in used.
recompile as the instruments here. everything works fine.
(many thanks to the man who shared his solution)
see more details here: https://github.com/ycm-core/YouCompleteMe/issues/3635
I suggest you go to your ~/.vimrc and add this at the beginning of the file BEFORE you begin your Plug declarations.
Example of ~/.vimrc:
From there you can
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:
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.
remove the configuration of python2:
–enable-pythoninterp,(remove this words)
because YouCompleteMe dropped support for python2.