Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upModuleNotFoundError: No module named 'gitdb.utils.compat' #983
Comments
Experiencing the same here.
We're using the |
@davidwneary Ah, that issue is due to GitDB v3.0.2 removing @mell0 |
@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. 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. |
@Harmon758 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. |
When can we expect this next release? |
I don't think creating a post-release for this is a good idea. As PEP 440 says, it's meant for issues that don't affect the actual software, like changes in release notes, and shouldn't be used for actual bug fixes. In addition, to cover every old version affected by the issue, we'd have to do 9 post-releases for 2.1.12 - 2.1.14 and 3.0.0 - 3.0.5. I agree that some of the recent releases should have been minor version bumps rather than patch version bumps, but I've only very recently become a maintainer and Byron has been doing the releases. We're still working on our development and release process, but we have an open line of communication now that should help. Apologies for any hassles this issue might have caused, but the root cause of the issue is that gitdb2 was not version locked. Having a minor version bump instead of a patch version bump wouldn't have affected the issue at all. In fact, any breaking change in GitDB, even with a major version bump, would have had the potential of breaking old GitPython versions. Future issues like this should be mitigated now with gitdb2 version-locked to < 4. If an unintentional breaking change in a patch version bump were to occur again, we could simply revert the change in another patch version bump and release it with a major version bump. As for resolving the current issue, if you're using an older version of GitPython, you can simply upgrade to the latest version of either major version, i.e. 3.0.8 or 2.1.15. Upgrading to 3.0.6 or 3.0.7 should resolve the issue as well. If you need to use an older version and can't upgrade, you'll have to add a requirement for gitdb2 < 3.0.2. |
And should it become necessary, we might even be able to fight fire with fire, and overwrite a previous release of gitdb. |
I ran into the same issue. I uninstalled GitPython and then reinstalling it to get past the original error and then I ended up pinning the GitPython version higher than 3.1.0 and a fully successful build. |
The gitpython version that was in use has a problem (see issue here: gitpython-developers/GitPython#983). As mentioned in the thread, this can be resolved by pinning the version to 3.1.x
gitpython-developers/GitPython#983 ====================================================================== ERROR: test_doctests (unittest.loader._FailedTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/builds/azul/azul/test/test_doctests.py", line 50, in load_tests tests.addTests(doctest.DocTestSuite(load_module(root + '/scripts/check_branch.py', 'check_branch'))) File "/builds/azul/azul/src/azul/modules.py", line 19, in load_module spec.loader.exec_module(module) File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/builds/azul/azul/scripts/check_branch.py", line 4, in <module> import git File "/build/.venv/lib/python3.6/site-packages/git/__init__.py", line 38, in <module> from git.exc import * # @nomove @IgnorePep8 File "/build/.venv/lib/python3.6/site-packages/git/exc.py", line 9, in <module> from git.compat import UnicodeMixin, safe_decode, string_types File "/build/.venv/lib/python3.6/site-packages/git/compat.py", line 16, in <module> from gitdb.utils.compat import ( ModuleNotFoundError: No module named 'gitdb.utils.compat' ----------------------------------------------------------------------
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.