jarolrod / vim-python-ide

Python development config
BSD 3-Clause "New" or "Revised" License
751 stars 91 forks source link

ImportError: No module named 'git' when I start Vim #5

Closed sagnibak closed 4 years ago

sagnibak commented 6 years ago

On Ubuntu 16.04 running on Windows Subsystem for Linux, whenever I am running vim, it is giving the following error:

Error detected while processing /home/sagnick/.vimrc:
line  403:
Traceback (most recent call last):
  File "<string>", line 2, in <module>
ImportError: No module named 'git'
Press ENTER or type command to continue

If I press enter, it opens vim like normal. Please note that I am quite new to Vim, so I am not sure if what is appearing is normal or not. I have attached two screenshots as well.

image

image

In the second image, there seems to be a Python-related error (right at the bottom), but I have no idea how to even look at the complete error. I would really appreciate some help!

Braincoke commented 6 years ago

Hi, As stated in the error message, the problem comes from this part of your .vimrc file :

 python3 << EOF
 import vim
 import git
 def is_git_repo():
       try:
           _ = git.Repo('.', search_parent_directories=True).git_dir
           return "1"
       except:
           return "0"
 vim.command("let g:pymode_rope = " + is_git_repo())
 EOF    

As you can see this is some python code trying to import the module git and you don't seem to have it on your computer. You can install it by running pip3 install gitpython (you might need to prepend sudo -H to the command line for it to work).

macsiwase commented 6 years ago

I'm still getting the same error even after installing gitpython

caco13 commented 5 years ago

Hi, As stated in the error message, the problem comes from this part of your .vimrc file :

 python3 << EOF
 import vim
 import git
 def is_git_repo():
       try:
           _ = git.Repo('.', search_parent_directories=True).git_dir
           return "1"
       except:
           return "0"
 vim.command("let g:pymode_rope = " + is_git_repo())
 EOF    

As you can see this is some python code trying to import the module git and you don't seem to have it on your computer. You can install it by running pip3 install gitpython (you might need to prepend sudo -H to the command line for it to work).

For me sudo pip3 install gitpython solved. Thanks @Braincoke.

viktorvillalobos commented 4 years ago

The same error, i think the error comes from "import vim" line, what package is that?