Repository navigation
Fixed protobuf version mismatch - #258
Merged
theodorbadea merged 2 commits intoNov 10, 2026
Merged
theodorbadea merged 2 commits into
theodorbadea merged 2 commits into
Conversation
|
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
ajbalogh
self-requested a review
November 9, 2026 18:43
razvcris
force-pushed
the
fix/issue-195-protobuf-version-mismatch
branch
from
November 10, 2026 12:58
afd64ea to
d26bf7a
Compare
theodorbadea
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The protobuf version in the generated et_def_pb2.py and the version of the protobuf package installed at runtime are chosen by two separate mechanisms. Nothing was tying them together. If the former were to be a newer version than the latter, it was possible that the generated python could come with functionalities that the runtime protobuf older version couldn't read. The first time anything imports
et_def_pb2.py, the file asks the runtime package for its version and compares it with the version stamped in its own header. In the above scenario, this test was failing, leading to the error from the Issue.The solution is to follow the rule: The gencode protobuf version needs to be older ( or at most equal ) to the runtime protobuf version. In order to achieve this, I pinned the compiler version and set the runtime floor to the gencode version. This means the two can't disagree.
The official protobuf documentation supports this decision: "New Gencode + Old Runtime = Never Allowed". For Python: "As of 6.32.0, all generated code since 3.20.0 will be supported until at least 8.x.y."
Test Plan
In the current setup,
pip install .resolves protobuf 7.36.2, gencode is 6.31.1, andchakra_generatorruns with exit 0 and no error.Bumping
grpcio-toolsto a newer version without properly updating the floor fails withVersionError.Lowering the floor fails with
VersionError.The smoke test introduced in the workflows (
python_tests.yml-> Protobuf Gencode/Runtime Smoke Test ) checks both the lower and the upper boundaries to make sure that the 2 versions are in sync. If they are not ( someone updated a pin but not the other ), the test fails.Additional Notes
The two pins must be bumped together by hand, otherwise they will get out of sync ( catched by the smoke test ).
On Python 3.15,
grpcio-tools1.80.0 has no wheel, so a source build compiles it, which is slow. Not a concern for now, but could be addressed in later issues, once the repo hardening is done.Closes #195