Thursday, September 28, 2017

Getting Ubuntu, Python 2.7, Jedi and Vim playing nice to each other

This took me some hours to figure out: how to finally set Jedi with Vim to have a good editor for Python 2.7 code.

Ubuntu 16.04 by default install Vim compiled against Python 3.5 interpreter, which is not immediate obvious but becomes a pain in the ass after you discover that even after installing Jedi and python-jedi, you're still getting the error message:

Please install Jedi if you want to use jedi-vim.

When opening a file with Python code.

To get things working for your Python 2.7 code, you might need to uninstall your current Vim related packages and install the following:
  • vim-addon-manager
  • vim-common
  • vim-gnome-py2
  • vim-gtk3-py2
  • vim-gui-common
  • vim-nox-py2
  • vim-python-jedi
  • vim-runtime
You can check your current configuration with:

$ dpkg-query -l 'vim*'