isl-org / Open3D-ML

An extension of Open3D to address 3D Machine Learning tasks
Other
1.86k stars 319 forks source link

Cannot import open3d.ml.torch ? #578

Open DeepDuke opened 1 year ago

DeepDuke commented 1 year ago

Checklist

My Question

Hi, when I try to import import open3d.ml.torch, this strange error occurs...

>>> import open3d.ml.torch as ml3d
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/spacex/.local/lib/python3.8/site-packages/open3d/ml/torch/__init__.py", line 122, in <module>
    from . import models
  File "/home/spacex/.local/lib/python3.8/site-packages/open3d/ml/torch/models.py", line 35, in <module>
    from open3d._ml3d.torch.models import *
  File "/home/spacex/.local/lib/python3.8/site-packages/open3d/_ml3d/torch/__init__.py", line 1, in <module>
    from .pipelines import *
  File "/home/spacex/.local/lib/python3.8/site-packages/open3d/_ml3d/torch/pipelines/__init__.py", line 3, in <module>
    from .semantic_segmentation import SemanticSegmentation
  File "/home/spacex/.local/lib/python3.8/site-packages/open3d/_ml3d/torch/pipelines/semantic_segmentation.py", line 9, in <module>
    from torch.utils.tensorboard import SummaryWriter
  File "/home/spacex/.local/lib/python3.8/site-packages/torch/utils/tensorboard/__init__.py", line 8, in <module>
    from .writer import FileWriter, SummaryWriter  # noqa F401
  File "/home/spacex/.local/lib/python3.8/site-packages/torch/utils/tensorboard/writer.py", line 10, in <module>
    from tensorboard.compat.proto.event_pb2 import SessionLog
  File "/home/spacex/.local/lib/python3.8/site-packages/tensorboard/compat/proto/event_pb2.py", line 17, in <module>
    from tensorboard.compat.proto import summary_pb2 as tensorboard_dot_compat_dot_proto_dot_summary__pb2
  File "/home/spacex/.local/lib/python3.8/site-packages/tensorboard/compat/proto/summary_pb2.py", line 17, in <module>
    from tensorboard.compat.proto import tensor_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__pb2
  File "/home/spacex/.local/lib/python3.8/site-packages/tensorboard/compat/proto/tensor_pb2.py", line 16, in <module>
    from tensorboard.compat.proto import resource_handle_pb2 as tensorboard_dot_compat_dot_proto_dot_resource__handle__pb2
  File "/home/spacex/.local/lib/python3.8/site-packages/tensorboard/compat/proto/resource_handle_pb2.py", line 16, in <module>
    from tensorboard.compat.proto import tensor_shape_pb2 as tensorboard_dot_compat_dot_proto_dot_tensor__shape__pb2
  File "/home/spacex/.local/lib/python3.8/site-packages/tensorboard/compat/proto/tensor_shape_pb2.py", line 36, in <module>
    _descriptor.FieldDescriptor(
  File "/home/spacex/.local/lib/python3.8/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
v-parmar commented 1 year ago

Hey @DeepDuke, This error is related to an issue with the protobuf library that is used by TensorBoard. The error message suggests that the protobuf library installed on your system is not compatible with the version used by the generated code in TensorBoard.

The suggested workarounds are to either downgrade the protobuf library to version 3.20.x or lower, or to set the environment variable "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python".

You can also try to regenerate the protobuf code with protoc version 3.19.0 or higher.