question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue With Protobuf Dependency

See original GitHub issue

Version: 1.10.0 Error:

Traceback (most recent call last):
  File "/home/circleci/repo/tests/modeling/export/test_export_model.py", line 5, in <module>
    from skl2onnx.common.data_types import FloatTensorType
  File "/home/circleci/.venv/lib/python3.9/site-packages/skl2onnx/__init__.py", line 15, in <module>
    from .convert import convert_sklearn, to_onnx, wrap_as_onnx_mixin  # noqa
  File "/home/circleci/.venv/lib/python3.9/site-packages/skl2onnx/convert.py", line 5, in <module>
    from .proto import get_latest_tested_opset_version
  File "/home/circleci/.venv/lib/python3.9/site-packages/skl2onnx/proto/__init__.py", line 8, in <module>
    from onnx import onnx_pb as onnx_proto  # noqa
  File "/home/circleci/.venv/lib/python3.9/site-packages/onnx/__init__.py", line 11, in <module>
    from onnx.external_data_helper import load_external_data_for_model, write_external_data_tensors, convert_model_to_external_data
  File "/home/circleci/.venv/lib/python3.9/site-packages/onnx/external_data_helper.py", line 14, in <module>
    from .onnx_pb import TensorProto, ModelProto
  File "/home/circleci/.venv/lib/python3.9/site-packages/onnx/onnx_pb.py", line 8, in <module>
    from .onnx_ml_pb2 import *  # noqa
  File "/home/circleci/.venv/lib/python3.9/site-packages/onnx/onnx_ml_pb2.py", line 33, in <module>
    _descriptor.EnumValueDescriptor(
  File "/home/circleci/.venv/lib/python3.9/site-packages/google/protobuf/descriptor.py", line 755, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

------------------------------------------------------------------------------
Ran 0 tests in 2.25s

Exited with code exit status 2

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:7

github_iconTop GitHub Comments

1reaction
xaduprecommented, Nov 24, 2022

This issue is more related to onnx, see https://github.com/onnx/onnx/pull/4242.

1reaction
davidmezzetticommented, Jun 7, 2022

sklearn-onnx does have a dependency defined for protobuf: https://github.com/onnx/sklearn-onnx/blob/main/requirements.txt

requirements.txt is read by setup.py and it’s a dependency with the current package on PyPI.

I’ve filed issues with onnxruntime, onnx and see this here. It’s surprising that there is no sense of urgency to fix this issue, which is a breaking change for many people. It seems like the earliest a fix will be available is weeks or months away.

The workaround of installing protobuf < 4 works but many don’t know protobuf is being used by onnx.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python: protobuf==4.21.0rc1 adds dependency on grpcio-tools
This error indicates that you are using old generated code. The file error_details_pb2.py must have been generated by a protoc prior to 3.19.0....
Read more >
dependency issue? - Google Groups
This started failing after having to regenerate the code since one of the dependent classes changed. Here is the exception details. ... com.google.protobuf....
Read more >
Protobuf/guava dependency issue - gradle - Stack Overflow
I'm running into an issue where protobuf is depending on guava version 28.1 for android which lacks the toImmutableX collectors. Because 28.1 is ......
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 >
com.google.protobuf:protobuf-java 3.11.4 vulnerabilities | Snyk
Known vulnerabilities in the com.google.protobuf:protobuf-java package. This does not include vulnerabilities belonging to this package's dependencies.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found