Pre-commit hook crashes while checkov importing LegacyVersion from packaging module which prevents commiting.
Current behavior
Checkov hook crashes with the following error:
ImportError: cannot import name 'LegacyVersion' from 'packaging.version' (/Users/alp/.cache/pre-commit/repovr64b5yh/py_env-python3.11/lib/python3.11/site-packages/packaging/version.py)
Describe the bug
Pre-commit hook crashes while checkov importing LegacyVersion from packaging module which prevents commiting.
Current behavior
Checkov hook crashes with the following error:
ImportError: cannot import name 'LegacyVersion' from 'packaging.version' (/Users/alp/.cache/pre-commit/repovr64b5yh/py_env-python3.11/lib/python3.11/site-packages/packaging/version.py)
Bug report and PR on checkov project. https://github.com/bridgecrewio/checkov/issues/4011 https://github.com/bridgecrewio/checkov/pull/4012
Possible solution
Use checkov version 2.2.125 in pre-commit hook which uses a pinned version of packaging for now.