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).
32 Answers
Following Installing GitPython, a simple pip install GitPython should be enough.
If not, check gitpython-developers/GitPython issue 1051:
0Even 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
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.