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.

tensorboardX is incompatible with protobuf 4.21.0

See original GitHub issue

This is originally found when our CI server installed protobuf 4.12.0, which was released today, as a dependency of the tensorboardX.

$ pip3 install tensorboardX  # installs the newest protobuf as a dependency
$ python3
Python 3.8.13 (default, Mar 17 2022, 16:53:17) 
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from tensorboardX import SummaryWriter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/dtakahashi/Library/Python/3.8/lib/python/site-packages/tensorboardX/__init__.py", line 5, in <module>
    from .torchvis import TorchVis
  File "/Users/dtakahashi/Library/Python/3.8/lib/python/site-packages/tensorboardX/torchvis.py", line 11, in <module>
    from .writer import SummaryWriter
  File "/Users/dtakahashi/Library/Python/3.8/lib/python/site-packages/tensorboardX/writer.py", line 17, in <module>
    from .comet_utils import CometLogger
  File "/Users/dtakahashi/Library/Python/3.8/lib/python/site-packages/tensorboardX/comet_utils.py", line 7, in <module>
    from .summary import _clean_tag
  File "/Users/dtakahashi/Library/Python/3.8/lib/python/site-packages/tensorboardX/summary.py", line 13, in <module>
    from .proto.summary_pb2 import Summary
  File "/Users/dtakahashi/Library/Python/3.8/lib/python/site-packages/tensorboardX/proto/summary_pb2.py", line 16, in <module>
    from tensorboardX.proto import tensor_pb2 as tensorboardX_dot_proto_dot_tensor__pb2
  File "/Users/dtakahashi/Library/Python/3.8/lib/python/site-packages/tensorboardX/proto/tensor_pb2.py", line 16, in <module>
    from tensorboardX.proto import resource_handle_pb2 as tensorboardX_dot_proto_dot_resource__handle__pb2
  File "/Users/dtakahashi/Library/Python/3.8/lib/python/site-packages/tensorboardX/proto/resource_handle_pb2.py", line 36, in <module>
    _descriptor.FieldDescriptor(
  File "/Users/dtakahashi/Library/Python/3.8/lib/python/site-packages/google/protobuf/descriptor.py", line 560, 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
>>> 

Environment

$ pip3 list | grep -E "torch|proto|tensor"
protobuf                      4.21.0
tensorboard                   2.7.0
tensorboard-data-server       0.6.1
tensorboard-plugin-wit        1.8.0
tensorboardX                  2.5
torch                         1.10.1
$ python3 --version
Python 3.8.13

Thank you very much in advance.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
erikfreycommented, Jun 1, 2022

+1, brax uses tensorboardX and we are seeing this problem too.

But also, thanks for tensorboardX, we find it quite useful 😃

1reaction
erikfreycommented, Jun 7, 2022

@lanpa I just tried and it’s working for Brax:

  Running setup.py develop for brax
Successfully installed Pillow-9.1.1 absl-py-1.1.0 brax-0.0.13 chex-0.1.3 cloudpickle-2.1.0 cycler-0.11.0 dataclasses-0.6 dm-tree-0.1.7 flatbuffers-2.0 flax-0.5.0 fonttools-4.33.3 grpcio-1.46.3 gym-0.24.0 gym-notices-0.0.7 importlib-metadata-4.11.4 jax-0.3.13 jaxlib-0.3.10 kiwisolver-1.4.2 matplotlib-3.5.2 msgpack-1.0.4 numpy-1.22.4 opt_einsum-3.3.0 optax-0.1.2 packaging-21.3 protobuf-3.20.1 pyparsing-3.0.9 python-dateutil-2.8.2 pytinyrenderer-0.0.13 scipy-1.8.1 six-1.16.0 tensorboardX-2.5.1 toolz-0.11.2 trimesh-3.12.5 typing-extensions-4.2.0 zipp-3.8.0

So looks like I’m OK with 3.20.1 - thanks for checking. I hope that when tensorboard upstream fixes this protobuf compatibility issue, it allows you to undo this change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TensorBoard's generated pb2.py files are incompatible with ...
The final release protobuf 4.21.0 has a different error message, TypeError: Descriptors cannot not be created directly. . Current status:.
Read more >
Why am I receiving protobuff errors when using pip to install ...
Error: "tensorflow 1.7.0 has requirement protobuf>=3.4.0, but you'll have protobuf 3.1.0.post1 which is incompatible.
Read more >
Protobuf 3.20.1 which is incompatible - Using Streamlit
I'm trying to deploy an app with tensorflow but I keep getting an error from protobuf incompatibility. Steps to reproduce. Code snippet:
Read more >
Tensorflow installation fails - Jetson AGX Orin
tensorboard 2.10.1 requires protobuf<3.20,>=3.9.2, but you have protobuf 4.21.9 which is incompatible. When I try to import tensorflow I get ...
Read more >
protobuf · PyPI
protobuf 4.21.12. pip install protobuf. Copy PIP instructions. Latest version. Released: Dec 14, 2022. No project description provided ...
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