VIM python support on Ubuntu 16.04 [duplicate]

I use ubuntu 16.04. My Vim doesn't have Python support. The thing is that I installed vim, vim-gnome, vim-nox, I surfed net for hours and tried to build vim from source, I deleted some stuff like vim-tiny and ubuntu-minimal, whatever I did - nothing worked.

Can anyone help me to get that Python support for Vim?


Here's what I do to get python support in vim

apt-get install -y python-software-properties software-properties-common

add-apt-repository ppa:pi-rho/dev

# add this repo so that vim has python 4? compiled in to support plugins like gundo
add-apt-repository -y ppa:pi-rho/dev
apt-get update

install vim-gtk

this install a massive vim build that will give you everything

apt-get install -y vim-gtk

Running these commands on Ubuntu 16.04 worked for me about 2 weeks ago.

problems with versions

The way this can cause problems is that by default, apt-get will install the newest version of the package, usually the pi-rho repo version is far newer than say 14.04's vim-gtk package and apt will install the pi-rho version. However on 16.04 the ubuntu universe? repo for vim-gtk has been neck and neck for versions with pi-rho - but the ubuntu package doesn't seem to have python support. ( I may be wrong on this though ). so ideally you would run

apt-cache policy vim-gtk

prior to install to check that apt will install pi-rho, if not you will have to run something like

sudo apt-get install vim-gtk=<version>

Those packages have +python3 support. If you want Python 2 support (+python), install the py2 packages (vim-nox-py2, vim-gnome-py2, etc.).


If you get vim-nox, you'll have python 3 support:

sudo apt-get install vim-nox

Then:

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

If you need python 2 support instead of python 3:

sudo apt-get install vim-nox-py2