Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python3 + pygit: "No module named 'repository'"

When using python3 with the pygit dependency, I hit an error that says:

Traceback (most recent call last):
  File "generate.py", line 8, in <module>
    from git         import Repo, NoSuchPathError, InvalidGitRepositoryError
  File "/mnt/c/Users/foo/venv/lib/python3.6/site-packages/git/__init__.py", line 6, in <module>
    from repository import Repository, InvalidRepositoryError
ModuleNotFoundError: No module named 'repository'

If I find in site-packages, I find a module called repository. What's the deal?

like image 697
Blake Avatar asked Oct 29 '25 14:10

Blake


1 Answers

You meant to use a different module called gitpython. You'll want to uninstall pygit and get gitpython instead.

Pro-tip: use a requirements.txt file to lock down your dependencies to prevent this from happening.

like image 143
Blake Avatar answered Oct 31 '25 04:10

Blake



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!