Repository navigation
ModuleNotFoundError: No module named 'gitdb.utils.compat' #983
Description
Activity
Experiencing the same here.
from gitdb.utils.compat import ( ModuleNotFoundError: No module named 'gitdb.utils.compat'We're using the
3.0.5release. Looks like the latest release to gitdb (3.0.2) has caused the issue - if I addgitdb2==3.0.1to my requirements.txt, it's fixed.Reacted by MaShuo, Krzysztof, Saisankar Gochhayat, Deepak Sharma, Shyamin Ayesh, Azzam S.A, Mohit Maithani, Hamman Samuel, Matthias Greiner and ThomazReacted by Mohit Maithani@davidwneary Ah, that issue is due to GitDB v3.0.2 removing
gitdb.utils.compat.
I'll push a fix momentarily.
That import was removed with GitPython v3.0.6 (b5dd2f0, a10ceef, 5d22d57) so the latest versions shouldn't have that issue.@mell0
gitdb2is the samegitdblibrary renamed on PyPI due to loss of access to the original PyPI account. See gitpython-developers/gitdb#45, gitpython-developers/gitdb#47, and pypi/support#204. The import remainsgitdb.Reacted by ChristianKuehnel, Adrià Garriga-Alonso and Derek Ardolf@davidwneary Actually, that import was removed with v3.0.6. This should be resolved in the latest versions.
@mell0 I'm unable to reproduce this in a new environment with the latest versions of both libraries, i.e. gitpython v3.0.8 and gitdb2 v3.0.2. If your issue is different, can you provide the details of your environment, e.g. gitpython, gitdb2, and python versions, and the full traceback?
Hi,
Problem is when trying to install an older version for GitPython which I had in my test requirements file, to be specific v3.0.4. I understood that this was fixed in versions above v3.0.6. It's just that v3.0.4 should have used in its requirements working gitdb2 version with compat included, because now I have a lot of deployment fails of my apps and I'm sure it's not only me. In my opinion requirements should contain more specific version of the dependencies not just >=, because thus way people using older version and relying on it are suffering and in general at the moment older versions <=v3.0.6 are not working.
To reproduce, just create new virtual env, try to install GitPython==3.0.4, and try to import it.
I agree that the versioning is less than ideal here. In fact, GitPython shouldn't have been using GitDB compatibility shims in the first place, causing the removal to be a breaking change, as they should have been internal rather than exposed.
I've gone ahead and restricted the gitdb2 version to < 4 now with e81fd54 to mitigate future issues like this, and it should be part of the next release.
However, there's not much that can be done at this point for older versions that rely on gitdb2 < 3.0.2. Even if the GitDB removal was reverted, since it wasn't restricted to < or <= any certain version for GitPython, any breaking change in the future would still break older GitPython versions.
But since the only GitPython version requirement for gitdb2 was >= 2 for older versions, you can simply specify gitdb2 < 3.0.2 in your own dependencies if you want to continue using an older version of GitPython.In fact, there was an issue with the formatting of the version specifier that wasn't fixed until GitPython v3.0.6, so you should be able to specify and install any gitdb2 version (although I can't guarantee that it'll work with < 2). It's just that, by default, the latest version will be installed.
Reacted by 0x26res and Laura BeaufortReacted by Francis Charette-Migneault, Chris Guillory and Dion Bosschieter@Harmon758
You could do a post release (https://www.python.org/dev/peps/pep-0440/#post-releases).
An hotfix for such a thing would avoid many unexpected problems by devs that tagged this version in order to have stable code, but suddenly still get an error.I would also argue that using the patch number instead of (at least) minor for such big refactoring isn't really a best practice to avoid situations like this in the future.
28 remaining items
- added a commit that references this issue
on Mar 19, 2020 - unpinned this issue
on Apr 11, 2020 - added a commit that references this issue
on May 4, 2020 - added a commit that references this issue
on Sep 10, 2020 - added a commit that references this issue
on Sep 23, 2020 Experiencing the same here.
from gitdb.utils.compat import ( ModuleNotFoundError: No module named 'gitdb.utils.compat'We're using the
3.0.5release. Looks like the latest release to gitdb (3.0.2) has caused the issue - if I addgitdb2==3.0.1to my requirements.txt, it's fixed.yeah 3.0.1 worked for me too, Thanks !
- added a commit that references this issue
on Dec 24, 2020 - added a commit that references this issue
on Dec 15, 2021 - added a commit that references this issue
on Jun 9, 2022 - added a commit that references this issue
on Aug 3, 2022 - added a commit that references this issue
on Nov 17, 2022


Requirments file includes gitdb2 and, but "compat.py" file is importing "gitdb" instead and throwing missing "gitdb" module error when this library is fresh installed in a new enviroment with missing "gitdb" dependency library. Please fix the problem.