tensorboardX icon indicating copy to clipboard operation
tensorboardX copied to clipboard

cannot import name 'event_pb2'

Open geelin opened this issue 5 years ago • 12 comments

Describe the bug When install from the source code by running python setup.py install, it shows that cannot import name 'event_pb2' when import tensorboardX. Running pip install -e . can solve this.

Minimal runnable code to reproduce the behavior

import tensorboardX
...

Environment protobuf 3.7.1
tensorboard 1.10.0
tensorboardX 1.7+e932310
tensorflow 1.10.0
tensorflow-estimator 1.13.0
tensorflow-tensorboard 1.5.1
torch 1.1.0
torchvision 0.3.0

Ubuntu 18.04 LTS

geelin avatar Jun 19 '19 20:06 geelin

Can't reproduce :( tested on MacOS, ubuntu 16.04 and 18.04

lanpa avatar Jun 22 '19 12:06 lanpa

have the same error. in tensorboardX/event_file_writer.py: from .proto import event_pb2 but cannot find event_pb2. git log version: 059d088f12ca4d19c29e10530d9906c77ad7e657

1973Blunt avatar Jun 24 '19 00:06 1973Blunt

it seems like that setup.py installation causes to delete tensorboardX/proto/event_pb2.py. git status:

        modified:   tensorboardX/__init__.py
        deleted:    tensorboardX/proto/attr_value_pb2.py
        deleted:    tensorboardX/proto/event_pb2.py
        deleted:    tensorboardX/proto/graph_pb2.py
        deleted:    tensorboardX/proto/layout_pb2.py
        deleted:    tensorboardX/proto/node_def_pb2.py
        deleted:    tensorboardX/proto/plugin_pr_curve_pb2.py
        deleted:    tensorboardX/proto/plugin_text_pb2.py
        deleted:    tensorboardX/proto/resource_handle_pb2.py
        deleted:    tensorboardX/proto/step_stats_pb2.py
        deleted:    tensorboardX/proto/summary_pb2.py
        deleted:    tensorboardX/proto/tensor_pb2.py
        deleted:    tensorboardX/proto/tensor_shape_pb2.py
        deleted:    tensorboardX/proto/types_pb2.py
        deleted:    tensorboardX/proto/versions_pb2.py

release v1.7 is ok

1973Blunt avatar Jun 24 '19 00:06 1973Blunt

@1973Blunt I guess there are other error messages like "protobuf compilation error". Did you see that as well?

lanpa avatar Jun 25 '19 15:06 lanpa

Same issue. I installed the newest version and built from the source code

TomorrowIsAnOtherDay avatar Jul 16 '19 03:07 TomorrowIsAnOtherDay

@TomorrowIsAnOtherDay Can you show the result of pip list along with all the error messages? Thanks

lanpa avatar Jul 16 '19 15:07 lanpa

It seems to be the problem of an incompatible version of protobuf, and I have solved the problem by reinstalling it. Thanks for replying.

TomorrowIsAnOtherDay avatar Jul 16 '19 15:07 TomorrowIsAnOtherDay

@TomorrowIsAnOtherDay Hi, current version should have a requirement of protobuf >= 3.6.1 during setup. It would be great if you can share how you fix the problem. (reinstall protobuf or reinstall tensorboardX or create new environment, etc.) Thanks

lanpa avatar Jul 16 '19 18:07 lanpa

Same issue. I installed the version 1.8 and built from the source code. The error messages: Traceback (most recent call last): File "main.py", line 18, in from tensorboardX import SummaryWriter File "/usr/local/anaconda3/lib/python3.7/site-packages/tensorboardX/init.py", line 5, in from .torchvis import TorchVis File "/usr/local/anaconda3/lib/python3.7/site-packages/tensorboardX/torchvis.py", line 11, in from .writer import SummaryWriter File "/usr/local/anaconda3/lib/python3.7/site-packages/tensorboardX/writer.py", line 15, in from .event_file_writer import EventFileWriter File "/usr/local/anaconda3/lib/python3.7/site-packages/tensorboardX/event_file_writer.py", line 28, in from .proto import event_pb2 ImportError: cannot import name 'event_pb2' from 'tensorboardX.proto' (/usr/local/anaconda3/lib/python3.7/site-packages/tensorboardX/proto/init.py)

padluo avatar Jul 26 '19 02:07 padluo

@padluo Because release v1.8 still have the patch I mentioned. Please remove old versions and install from source again.

lanpa avatar Jul 26 '19 12:07 lanpa

i find the way to solve it. cannot use "pip install -e . " to install the environment. if you do so, the file 'event_pd2' will be deleted. you can unzip the zip file and find it in /tensorboardX/proto . copy it and solve or just use python setup.py install to install in first time.

wangj346 avatar Mar 01 '20 09:03 wangj346

Met the "cannot import name 'event_pb2'" issue, on jetson TX2 (arm platform); I installed v1.8 and v1.9 from source, problem remained; Using the v1.7 solved it, wish this could help. Command is git clone --recursive --branch=v1.7 https://github.com/wqdun/tensorboardX.git

wqdun avatar Mar 02 '20 02:03 wqdun