Unable to import git in python

I am facing these issues. Can you help me with the same ? Why am I seeing this error ? Do I have to add anything in the requirements.txt file ?

>>> import git
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
 import git
File "git\__init__.py", line 29, in <module>
_init_externals()
File "git\__init__.py", line 23, in _init_externals
raise ImportError("'gitdb' could not be found in your PYTHONPATH")
ImportError: 'gitdb' could not be found in your PYTHONPATH

>>> from git import Repo
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
from git import Repo
File "git\__init__.py", line 29, in <module>
_init_externals()
File "git\__init__.py", line 23, in _init_externals
raise ImportError("'gitdb' could not be found in your PYTHONPATH")
ImportError: 'gitdb' could not be found in your PYTHONPATH

Answers


I also got the message ImportError: 'gitdb' could not be found in your PYTHONPATH (when trying to use GitPython).BUT I had gitdb already installed! Thanks to this hint I figured out that gitdb silently failed because it was missing smmap. So I installed this and it worked.


You need to install gitdb package.

$ sudo easy_install gitdb

I had the same problem. However, gitdb and smmap were already installed by pip. As I used brew to install python and its dependencies on my mac, when I checked brew doctor command, it said that my /usr/local/sbin directory is not in my PATH. So I added it to my PATH (though it didn't have anything to do with the python) and everything worked out eventually.


Need Your Help

How to decode NSData on iOS with RSA key?

ios encoding rsa nsdata decoding

I like to know how to decrypt (and encrypt) NSData with an RSA key? I have know idea how to do this. Is there already a build in methode in the normal iOS Frameworks?