Commit 2fd4d63
committed
RHAIENG-1277: fix(ci): monkypatch a protobuf 6.x (6.31) incompatibility
`AttributeError: 'MessageFactory' object has no attribute 'GetPrototype'` is not a problem in your own code—it is a **library-level incompatibility** that started to appear after the release of **protobuf ≥ 6.30** (especially 6.31).
Google removed/deprecated the method `MessageFactory.GetPrototype` and replaced it with `GetMessageClass`.
TensorFlow, PyTorch, Transformers, YOLO, ComfyUI, etc. still contain helper code that tries to call the old name, so the exception is raised **while they are being imported or while they build a graph**, not while your script is doing anything special.
## What you can (and should) do
1. **Down-grade protobuf to the last 5.x line** (5.29.4 or lower).
That version still has `GetPrototype`, so the error disappears immediately.
```bash
pip install -U "protobuf<6.0" # 5.29.4 is the newest 5.x
```
After the downgrade **restart the Python kernel / re-launch the process** so the already-imported modules disappear from `sys.modules`.
> 99 % of the reports on GitHub, HF, Ultralytics, ComfyUI, etc. are solved by this single step .
2. **Keep every other package at their current version**; you do **not** need to downgrade TensorFlow, PyTorch, etc.
Protobuf 5.29 is forward-compatible with every major framework that ships `.proto` files.
3. **If you must stay on protobuf 6.x** you would have to patch the offending code yourself (monkey-patch `google.protobuf.message_factory.MessageFactory.GetPrototype` so that it simply aliases `GetMessageClass`).
A few projects already ship such a shim, but most users simply stay on 5.x until the ecosystem catches up .
4. **Watch the issue trackers** (TensorFlow #94030, Ultralytics #20527, …).
When the libraries eventually release a version that says “supports protobuf 6.x” you can upgrade again.1 parent 6db118d commit 2fd4d63
File tree
6 files changed
+24
-0
lines changed- jupyter
- rocm/tensorflow/ubi9-python-3.12
- tensorflow/ubi9-python-3.12
- utils
- runtimes
- rocm-tensorflow/ubi9-python-3.12
- tensorflow/ubi9-python-3.12
6 files changed
+24
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
| |||
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
| 156 | + | |
| 157 | + | |
155 | 158 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| |||
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
| 163 | + | |
| 164 | + | |
162 | 165 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| 80 | + | |
| 81 | + | |
79 | 82 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| 83 | + | |
| 84 | + | |
82 | 85 | | |
0 commit comments