You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ModuleNotFoundError: No module named 'gitdb.utils.compat' #983
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.
from gitdb.utils.compat import (
ModuleNotFoundError: No module named 'gitdb.utils.compat'
We're using the 3.0.5 release. Looks like the latest release to gitdb (3.0.2) has caused the issue - if I add gitdb2==3.0.1 to 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 Thomaz
@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 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?
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.
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.
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.
from gitdb.utils.compat import (
ModuleNotFoundError: No module named 'gitdb.utils.compat'
We're using the 3.0.5 release. Looks like the latest release to gitdb (3.0.2) has caused the issue - if I add gitdb2==3.0.1 to my requirements.txt, it's fixed.
Activity
davidwneary commentedon Feb 17, 2020
Experiencing the same here.
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.Harmon758 commentedon Feb 17, 2020
@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.Harmon758 commentedon Feb 17, 2020
@davidwneary Actually, that import was removed with v3.0.6. This should be resolved in the latest versions.
Harmon758 commentedon Feb 17, 2020
@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?
mell0 commentedon Feb 17, 2020
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.
mell0 commentedon Feb 17, 2020
To reproduce, just create new virtual env, try to install GitPython==3.0.4, and try to import it.
Harmon758 commentedon Feb 17, 2020
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.
work around GitPython issue (gitpython-developers/GitPython#983)
fmigneault commentedon Feb 18, 2020
@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
increased requested gitpython version to v3.0.8 to avoid this:
GitPython==3.1.0 gitpython-developers/GitPython#983
Update tests and fix gitpython version
Pin transitive dep on gitdb to avoid ModuleNotFoundError
The old version of gitpython is broken now.
Update GitPython version due to gitpython-developers/GitPython#983
mmaithani commentedon Dec 4, 2020
yeah 3.0.1 worked for me too, Thanks !
Bump GitPython version to fix a crash for gitdb.utils.compat
Attempt to fix gitpython-developers/GitPython#983.
Test new version of GitPython gitpython-developers/GitPython#983
Remove dependency on outdated GitPython
Update GitPython dependency
Squashed commit of the following:
Pin transitive dep on gitdb to avoid ModuleNotFoundError