lanpa / tensorboardX

tensorboard for pytorch (and chainer, mxnet, numpy, ...)
https://tensorboardx.readthedocs.io/en/latest/tensorboard.html
MIT License
7.87k stars 862 forks source link

cannot import name 'event_pb2' #455

Open geelin opened 5 years ago

geelin commented 5 years ago

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

lanpa commented 5 years ago

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

1973Blunt commented 5 years ago

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 commented 5 years ago

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

lanpa commented 5 years ago

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

TomorrowIsAnOtherDay commented 5 years ago

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

lanpa commented 5 years ago

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

TomorrowIsAnOtherDay commented 5 years ago

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

lanpa commented 5 years ago

@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

padluo commented 5 years ago

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)

lanpa commented 5 years ago

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

wangj346 commented 4 years ago

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.

wqdun commented 4 years ago

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