ModuleNotFound : No module named "git"

Viewed 6167

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).

1 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

Related