onnx requirement lists protobuf >=3.12.2,<=3.20.1 but does not work on 3.19 and below
See original GitHub issueBug Report
Is the issue related to model conversion?
No.
Describe the bug
When onnx is installed with protobuf 3.19 or less it fails on load on import despite that being valid given onnx requirements.
This is not a problem with protobuf 3.20.0.
System information
- OS Platform and Distribution (e.g. Linux Ubuntu 16.04): MacOS 12.5.1 (arm64)
- ONNX version (e.g. 1.7): 1.12.0
- Python version: 3.10.6
- Protobuf version: 3.19.4
Reproduction instructions
$ pipenv install protobuf==3.19.4 onnx
...
$ pipenv graph
onnx==1.12.0
- numpy [required: >=1.16.6, installed: 1.23.2]
- protobuf [required: >=3.12.2,<=3.20.1, installed: 3.19.4]
- typing-extensions [required: >=3.6.2.1, installed: 4.3.0]
$ pipenv run python -c "import onnx"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/damon/Downloads/test-onnx/.venv/lib/python3.10/site-packages/onnx/__init__.py", line 6, in <module>
from onnx.external_data_helper import load_external_data_for_model, write_external_data_tensors, convert_model_to_external_data
File "/Users/damon/Downloads/test-onnx/.venv/lib/python3.10/site-packages/onnx/external_data_helper.py", line 9, in <module>
from .onnx_pb import TensorProto, ModelProto, AttributeProto, GraphProto
File "/Users/damon/Downloads/test-onnx/.venv/lib/python3.10/site-packages/onnx/onnx_pb.py", line 4, in <module>
from .onnx_ml_pb2 import * # noqa
File "/Users/damon/Downloads/test-onnx/.venv/lib/python3.10/site-packages/onnx/onnx_ml_pb2.py", line 5, in <module>
from google.protobuf.internal import builder as _builder
ImportError: cannot import name 'builder' from 'google.protobuf.internal' (/Users/damon/Downloads/test-onnx/.venv/lib/python3.10/site-packages/google/protobuf/internal/__init__.py)
Expected behavior
If onnx is incompatible with protobuf versions that should be accurately reflected in requirements.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:10 (4 by maintainers)
Top Results From Across the Web
torch-cuda111 and onnx protobuf conflict - Stack Overflow
So I installed the latest version of protobuf which is 3.19.4, which is not compatible with protobuf 3.6.1. For now, they work just...
Read more >Protocol Buffer Basics: Java - Google Developers
This tutorial provides a basic Java programmer's introduction to working with protocol buffers. By walking through creating a simple example application, ...
Read more >Streamlit run with protocbuf error
Dear all, I am trying to run streamlit under Ubuntu and get the following error: streamlit Traceback (most recent call last): File ...
Read more >onnx - PyPI
The minimum Protobuf compiler (protoc) version required by ONNX is 3.0.0. Please note that old protoc versions might not work with ...
Read more >com.google.protobuf:protobuf-java vulnerabilities | Snyk
version published direct vulnerabilities
4.0.0‑rc‑2 20 Jul, 2020 0. C. 0. H. 0. M. 0. L
4.0.0‑rc‑1 16 Jul, 2020 0. C. 0. H. 0....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jcwchen Ahhhh… using
-vv
when installing with pip I can see it’s not using a wheel and so builds it from source. This explains it.Looking through the install I can see there are no
_arm64
or_universal2
wheels. I had been following an onnx (or onnxruntime) issue about M1 support and saw it had been merged in before v1.12. I had assumed this would mean there would be wheels in v1.12 but now I see from #3129 that that is not the case.I will close this as #3129 will solve it.
Thanks for your time.
I can’t install onnx from
python3 -m pip install numpy onnx
error message: