2
votes

I am trying to install jedi-vim. I am doing this at work - so I have to use gVim in Windows. I have already read several other posts in this forum. This has somehow made me smarter but still does not solve my problem.

I did the following things:

  1. installed Pathogen
  2. cloned jedi vim from https://github.com/davidhalter/jedi-vim.git and copied it to the bundle/ folder in the vim-dir.
  3. Now, when I open a *.py-file vim always tells me

    jedi-vim requires vim compiled with +python

    but ':version' tells me that it's compiled with +python/dyn and +python3/dyn.

So what is the problem?

Additional infos:

  • vim version: 7.4
  • When I use ctrl+space to autocomplete a python key word, it tells me:

    Error detected while processing function jedi#completions: line 1: E492: Not an editor command: Python jedi_vim.completions()
    Error detected while processing function jedi#completions: line 1: E492: Not an editor command: Python jedi_vim.completions()
    Press ENTER or type command to continue

3
I'm not sure this is really a question for SO. Sure, it's about installing and configuring Python and/or vi, which only programmers (or maybe sysadmins) are likely to care about, but I think you might find better answers on SuperUser. - abarnert

3 Answers

1
votes

I'm not sure if your are still experiencing the same issue, but after looking around I found this blog post that solved the problem for me. Essentially, it's just about re-installing vim (don't delete any config files) and then reinstalling from the source at the vim mercurial repo with the right flags. There might be a shorter/simpler version of doing this, but after trying back and forth many solutions, this one was the only one that worked:

These are the steps: Check if Vim is compiled with Python:

$ vim --version | ack '(python)'

Remove Vim version installed:

$ sudo apt-get remove vim-common vim-runtime

Install dependencies needed to compile Vim:

$ sudo apt-get build-dep vim

Clone Vim repository, compile it and install the new version:

$ hg clone https://vim.googlecode.com/hg/ vim
$ cd vim
$ ./configure --enable-pythoninterp
$ make
$ sudo make install
0
votes

+python/dyn means that Python support isn't statically compiled it, it's loaded dynamically when needed at runtime.

This is described in the python-dynamic help section:

On MS-Windows the Python library can be loaded dynamically. The |:version| output then includes |+python/dyn|.

This means that Vim will search for the Python DLL file only when needed. When you don't use the Python interface you don't need it, thus you can use Vim without this DLL file.

To use the Python interface the Python DLL must be in your search path. In a console window type "path" to see what directories are used.

The name of the DLL must match the Python version Vim was compiled with. Currently the name is "python24.dll". That is for Python 2.4. To know for sure edit "gvim.exe" and search for "python\d*.dll\c".

(Don't worry about the 2.4 there; I just happened to find docs from a few years ago. Read the help in your own copy of vim—or, better, do what the last paragraph says.)

So, either you don't have Python, you have the wrong version of Python, it's not on your %PATH%, vim is searching for it incorrectly, or it's failing to load.

0
votes

At that time the problem was another one. I mixed up the architectures for vim and python - I used vim64Bit, but pyhton for 32bit. I repaired that already some time ago but the other day I had to restart my computer and do some microsoft-Updates. Unfortunately my vim (7.4) was totally broken. I had to re-set my home-dir. Then at least my vimrc was accessible again, but still my jedi in vim does not work.

Python is available in vim but still jedi does not seem to load correctly. When I type "len(" in the beginning of a .py-file, at the place where arguments should be explained there are some strange characters, similar to this: ==jedi=0, == (_object_*) ==jedi==

When I type "self.", it says "unknown function: pythoncomplete#Complete"

I think it's only a configuration-issue, because it worked before the reboot. Jedi is installed systemwide (with pip). If I try to install it "again", pip says that jedi is already installed.

I would appreciate your help very much ;-)