onnx / tensorflow-onnx

Convert TensorFlow, Keras, Tensorflow.js and Tflite models to ONNX
Apache License 2.0
2.3k stars 432 forks source link

Project requires an old version of Protobuf #2328

Open wingdagger opened 5 months ago

wingdagger commented 5 months ago

The following setup.py file requires version ~=3.20 of protobuf. This is a very old release. Protobuf is currently on version 5.26.1. This constraint of ~=3.20 is causing conflicts when I generate my python dependencies. Can you please allow for newer versions of protobuf? Thank you.

https://github.com/onnx/tensorflow-onnx/blob/ed022438576ca7a351c3858105439f4f25c35219/setup.py#L85C95-L85C111

fatcat-z commented 4 months ago

Thanks for your comments..

At this moment, tf2onnx is still designed to support older TensorFlow versions as many as possible and some of them could not work on a version above 3.20.x. In addition, couple of dependencies of tf2onnx also required the protobuf version ~= 3.20.0, so we can't upgrade its version in setup.py now.

wingdagger commented 4 months ago

Thank you for the fast response. Shouldn't tensorflow indicate the prereq version of protobuf that it requires. tf2onnx should not need to specify versions required by another project, right?

yan12125 commented 4 months ago

Shouldn't tensorflow indicate the prereq version of protobuf that it requires.

Apparently only tensorflow > 2.10 does that. That's probably why many tests fail with older tensorflow versions in #2327.

yan12125 commented 4 months ago

Here is an idea: Python 3.11 is supported since tensorflow 2.12. I think it's safe to say on Python >= 3.11, tensorflow already properly specifies compatible protobuf versions. How about something like this?

install_requires=[
    # (other dependencies)
    'protobuf~=3.20; python_version < "3.11"',
    'protobuf; python_version >= "3.11"',
]

In addition, couple of dependencies of tf2onnx also required the protobuf version ~= 3.20.0

I didn't check other dependencies. Such a trick may apply as well.