Youcompleteme: Report "YouCompleteMe unavailable: requires Vim compiled with Python 2.x support" error

Created on 15 Jan 2016  Â·  35Comments  Â·  Source: ycm-core/YouCompleteMe

Hi,

For my vim version:

$vi --version | grep python
+cryptv          +linebreak       +python/dyn      +viminfo
+cscope          +lispindent      +python3/dyn     +vreplace

we can see has * +python/dyn*, but when I open my vim everytime, it reports error YouCompleteMe unavailable: requires Vim compiled with Python 2.x support .

Most helpful comment

For people encounter same problem as me, I have ubuntu 16.04
I install vim 8 from ppa:jonathonf/vim which don't have python support
Simply install vim-nox for python3 and vim-nox-py2 for python2 for python support in vim

All 35 comments

Even if your Vim is compiled with dynamic loading of the Python library, it still needs to load it. You can check this by running the :echo has('python') command inside Vim. It must return 1.

You probably need to install the Python package for development (python-dev or python-devel depending on your distribution).

I am closing this issue because it is not specific to YCM.

@micbou Thanks for your answer, actually I had python-devel install on my distribution, I re-compiled the YouCompleteMe, and the error message disappeard,

I'm still hitting this issue after following the instructions on compiling vim from source. I had it working but decided I wanted to upgrade my version of vim (which is now at 7.4.2296). And no matter what I try I keep seeing this error. However, it is a little different:

YouCompleteMe unavailable: requires Vim compiled with Python (2.6+ or 3.3+) support

I'm on Ubuntu 16.04. I have both Python 2.7.12 and Python 3.5.2. Their config folders are of the config-x86_64-linux-gnu nature so I made sure to change --with-python-config-dir.

python-dev has already been installed as well.

Any help would be appreciated.

Here is the output of vim --version if it helps out at all. Again I am on Ubuntu 16.04.

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 31 2016 23:53:56)
Included patches: 1-2296
Compiled by 
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
+balloon_eval    +folding         +mouse_xterm     +termguicolors
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
+clientserver    +insert_expand   +packages        +toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python/dyn      +vreplace
+cscope          +lispindent      +python3/dyn     +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con_gui  +lua             +rightleft       +writebackup
+diff            +menu            +ruby            +X11
+digraphs        +mksession       +scrollbind      -xfontset
+dnd             +modify_fname    +signs           +xim
-ebcdic          +mouse           +smartindent     +xpm
+emacs_tags      +mouseshape      +startuptime     +xsmp_interact
+eval            +mouse_dec       +statusline      +xterm_clipboard
+ex_extra        +mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax
+farsi           +mouse_netterm   +tag_binary

In vim what is the output of :py print('py2') and :py3 print('PY3') ?

On 1 Sep 2016, at 05:36, Adam Beck [email protected] wrote:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 31 2016 23:53:56)
Included patches: 1-2296
Compiled by adam@kraynium
Huge version with GTK2 GUI. Features included (+) or not (-):
+acl +file_in_path +mouse_sgr +tag_old_static
+arabic +find_in_path -mouse_sysmouse -tag_any_white
+autocmd +float +mouse_urxvt -tcl
+balloon_eval +folding +mouse_xterm +termguicolors
+browse -footer +multi_byte +terminfo
++builtin_terms +fork() +multi_lang +termresponse
+byte_offset +gettext -mzscheme +textobjects
+channel -hangul_input +netbeans_intg +timers
+cindent +iconv +num64 +title
+clientserver +insert_expand +packages +toolbar
+clipboard +job +path_extra +user_commands
+cmdline_compl +jumplist +perl +vertsplit
+cmdline_hist +keymap +persistent_undo +virtualedit
+cmdline_info +lambda +postscript +visual
+comments +langmap +printer +visualextra
+conceal +libcall +profile +viminfo
+cryptv +linebreak +python/dyn +vreplace
+cscope +lispindent +python3/dyn +wildignore
+cursorbind +listcmds +quickfix +wildmenu
+cursorshape +localmap +reltime +windows
+dialog_con_gui +lua +rightleft +writebackup
+diff +menu +ruby +X11
+digraphs +mksession +scrollbind -xfontset
+dnd +modify_fname +signs +xim
-ebcdic +mouse +smartindent +xpm
+emacs_tags +mouseshape +startuptime +xsmp_interact
+eval +mouse_dec +statusline +xterm_clipboard
+ex_extra +mouse_gpm -sun_workshop -xterm_save
+extra_search -mouse_jsbterm +syntax
+farsi +mouse_netterm +tag_binary
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Also please ensure you are on latest YCM master. I can tell you are not because the error message was changed to show we support py3.

On 1 Sep 2016, at 05:34, Adam Beck [email protected] wrote:

I'm still hitting this issue after following the instructions on compiling vim from source. I had it working but decided I wanted to upgrade my version of vim (which is now at 7.4.2296). And no matter what I try I keep seeing this error.

I'm on Ubuntu 16.04. I have both Python 2.7.12 and Python 3.5.2. Their config folders are of the config-x86_64-linux-gnu so I made sure to change --with-python-config-dir.

Any help would be appreciated.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

The output for both of those 2 commands is

E319: Sorry, the command is not available in this version

I checked my ~/.vim/plugged/YouCompleteMe directory and did a git log. HEAD is pointing to commit e332cdb2a0c8599dead1d362b87bb9fb79c9a955.

I did a git pull --rebase and got

Current branch master is up to date.

Note: If you didn't catch it I did mention the error is different than the one OP posted:

YouCompleteMe unavailable: requires Vim compiled with Python (2.6+ or 3.3+) support

I don't believe this is a YouCompleteMe problem. So maybe this isn't the best forum to ask for a solution. But for some reason my Vim refuses to compile with python support.

UGH nevermind. I will begin by saying I'm not a linux expert. For some reason when I follow the steps to compile it places a linux executable in my /usr/local/bin which apparently is not being compiled correctly. However, there is also one in my /usr/bin which _is_ being compiled and doesn't throw this error.

I simply removed the one from /usr/local/bin and things seem to be fine now. I will have to investigate why those 2 are different because I believe I removed both before compiling vim. Hopefully this will help someone else out in the future.

I confirm, followed official instructions while compiling vim and followed official YouCompleteMe installation guide for ubuntu.
Before compilation I removed any vim related package from the system to exclude conflicts.

➜ ~ vim --version | grep python
+cryptv +linebreak -python +vreplace
+cscope +lispindent -python3 +wildignore

./configure --enable-pythoninterp=yes --enable-python3interp=yes support for py2 and py3

Let's see:
It is works !
➜ vim git:(master) ✗ vim --version | grep python
+cryptv +linebreak +python/dyn +vreplace
+cscope +lispindent +python3/dyn +wildignore

I have reproduced this issue in my workstation, details below;

talayhan@gabbage:~$ vim --version | grep python
+cryptv          +linebreak       +python/dyn      +vreplace
+cscope          +lispindent      +python3/dyn     +wildignore

And also
echo has('python')returns 0

Any idea ?

Same problem here. Doing some digging, it looks like dynamic loading of python is only available on windows.

http://stackoverflow.com/questions/20104827/vim-loading-python-on-linux

It happened to me as well. And turns out when I configure the python support, I passed a wrong python config dir, it should be /usr/lib/python2.7/config-x86_64-linux-gnu/ instead of /usr/lib/python2.7/config on my ubuntu 14.04. Recompile with correct dir works now.

And also
echo has('python')returns 0
Any idea ?

As @micbou said, if that's the case, then you have a problem with your Vim installation. In particular, it means that Vim can't find the python DLL/shared object.

Please contact Vim development and/or user groups for Vim support.

you can only

./configure --enable-pythoninterp=yes

For people encounter same problem as me, I have ubuntu 16.04
I install vim 8 from ppa:jonathonf/vim which don't have python support
Simply install vim-nox for python3 and vim-nox-py2 for python2 for python support in vim

@danielyang1009, vim-nox solved my problem with vim 8 too! Thanks for sharing the solution.

@danielyang1009, vim-nox solved my problem too.
But, for me, vim-nox-py2 did not add python2 support.

For information, YCM is not supported with anaconda, only with stock python. That's not to say that it categorically doesn't work, but we won't support it (i.e. You're on your own!).

@puremourning thanks for the clarification

I resolve this problem with installing vim-youcompleteme package on deepin.

I read the wiki "https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source".
But it misleads me.

Please DO NOT configure vim like this on Ubuntu 14.04.5 LTS

--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib/python2.7/config \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib/python3.5/config

Make sure only select one from python2 or python3.

@lebinhe that wiki page is Community maintained so if it is misleading just change it.

My solution (ubuntu 14.04):

sudo add-apt-repository ppa:jonathonf/vim

sudo apt update

sudo-get install vim-nox-py2

sudo mv /usr/local/bin/vim /usr/local/bin/vim.old

sudo ln -s /usr/bin/vim.nox-py2 /usr/local/bin/vim

For me on Debian (upgraded from 8 to 9) worked only:
./configure --enable-pythoninterp=yes --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu/
while:
./configure --enable-python3interp=yes --with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu
not.

@lebinhe thanks for your advice, it solved my problem. we can not config two python versions at the same time.

It says here (https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source) that you need to either install python2 or python3 support for Ubuntu 14.04 only, but I found that this issue happened even in Ubuntu 16.04. Once I used python3 support only, the error did appeared. So, we should probably leave a note highlighting that you should only use python2 or python3 for all versions.

After installing vim-nox using debian 9 works without error. Just for advice.

sudo apt install vim-nox -y

to follow up on jerryz920's comment:
he is referring to ./configure when you are building vim from source, so you need to pass the argument "/usr/lib/python2.7/config-x86_64-linux-gnu/" to :

./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib/python3.5/config \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-gui=gtk2 \
--enable-cscope \
--prefix=/usr/local

see this link : https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source

I'm on Debian 9, apt-get install vim-nox solved it for me.

@hellojebus What about windows?

future me, make sure you have 32/64bit python w/ 32/64bit vim

For Ubuntu 16.04, after install the plugin, do following to fix the issue:

sudo apt-get install vim-gnome-py2

This issue is not relevant anymore as Python 3 support was added a long time ago. The error message is now "YouCompleteMe unavailable: requires Vim compiled with Python (2.7.1+ or 3.4+) support." As such, I am locking the issue to avoid confusion.

@kuchaguangjie This shouldn't be needed since the default Vim has Python 3 support built in and Python 3 is installed by default on Ubuntu 16.04.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

d0u9 picture d0u9  Â·  4Comments

tgzhou98 picture tgzhou98  Â·  3Comments

beojan picture beojan  Â·  4Comments

jwu26 picture jwu26  Â·  3Comments

ioeric picture ioeric  Â·  4Comments