ModuleNotFound : No module named "git"

I was updating my git repo using the below command

python3 helper.py --update SomeName

But it is showing error like:

Traceback (most recent call last): File "helper.py", line 13, in <module> import git ModuleNotFoundError: No module named 'git' 

I have installed both Python 3 (3.8.5) and Python 2 (2.7.18).

3

2 Answers

Following Installing GitPython, a simple pip install GitPython should be enough.

If not, check gitpython-developers/GitPython issue 1051:

Even though I don't know what is causing this I do know that GitPython 2.x is supposed to work with Python 2 and 3, whereas GitPython 3 only works with Python 3.

It's hard to understand what exactly happened here, but when running pip3 install GitPython I am also unable to successfully run import git.

My best guess is that pip installs things outside of the PYTHONPATH, which certainly is surprising

0

What worked in my case, on Windows, was

python3 -m pip install gitpython 

Even after installing GitPython through pip3, the module was not being found, even if I included the appropriate paths. What worked is the command I mention.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like