Tensorboardx: Cannot import SummaryWriter

Created on 24 Aug 2017  ·  5Comments  ·  Source: lanpa/tensorboardX

When I try to do:

from tensorboard import SummaryWriter I get an error saying ImportError: cannot import name 'SummaryWriter'
After looking inside conda packages I found out that in the folder ~/anaconda3/lib/python3.6/site-packages/tensorboard/ there is no SummaryWriter, instead, I found it in the folder [...]/tensorboardX. Thus, I changed to from tensorboardX import SummaryWriter getting a new error when logging a scalar value that says TypeError: Parameter to MergeFrom() must be instance of same class: expected Summary got Summary. for field Event.summary

Any ideas of why is this happening?

Thanks in advance,
Manu.

Most helpful comment

Seems to be working after uninstalling tensorboard-pytorch and installing tensorboardX.
I will do further testing later and comment you the results.

Thanks!

All 5 comments

Hi, please post the result of 'pip freeze'. thanks
Manuel notifications@github.com於 2017年8月25日 週五,上午5:06寫道:

When I try to do:

from tensorboard import SummaryWriter I get an error saying ImportError:
cannot import name 'SummaryWriter'
After looking inside conda packages I found out that in the folder
~/anaconda3/lib/python3.6/site-packages/tensorboard/ there is no
SummaryWriter, instead, I found it in the folder [...]/tensorboardX.
Thus, I changed to from tensorboardX import SummaryWriter getting a new
error when logging a scalar value that says TypeError: Parameter to
MergeFrom() must be instance of same class: expected Summary got Summary.
for field Event.summary

Any ideas of why is this happening?

Thanks in advance,
Manu.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/lanpa/tensorboard-pytorch/issues/20, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AB6ZS4LEkci4pnWSs2QNGBC2g1QAvf8Tks5sbeXGgaJpZM4PB79p
.

>

iPhoneから送信

That's the ouput

alabaster==0.7.9
anaconda-client==1.6.0
anaconda-navigator==1.5
anaconda-project==0.4.1
astroid==1.4.9
astropy==2.0.1
Babel==2.3.4
backports.shutil-get-terminal-size==1.0.0
backports.weakref==1.0rc1
beautifulsoup4==4.5.3
bitarray==0.8.1
blaze==0.10.1
bleach==1.5.0
bokeh==0.12.4
boto==2.45.0
Bottleneck==1.2.1
cffi==1.9.1
chardet==2.3.0
chest==0.2.3
click==6.7
cloudpickle==0.2.2
clyent==1.2.2
colorama==0.3.7
conda==4.3.25
configobj==5.0.6
contextlib2==0.5.4
cryptography==1.7.1
cycler==0.10.0
Cython==0.26
cytoolz==0.8.2
dask==0.13.0
datashape==0.5.4
decorator==4.0.11
dill==0.2.5
docutils==0.13.1
et-xmlfile==1.0.1
fastcache==1.0.2
Flask==0.12
Flask-Cors==3.0.2
gevent==1.2.1
greenlet==0.4.11
h5py==2.7.0
HeapDict==1.0.0
html5lib==0.9999999
idna==2.2
imagesize==0.7.1
ipykernel==4.5.2
ipython==5.1.0
ipython-genutils==0.1.0
ipywidgets==5.2.2
isort==4.2.5
itsdangerous==0.24
jdcal==1.3
jedi==0.9.0
Jinja2==2.9.4
jsonschema==2.5.1
jupyter==1.0.0
jupyter-client==4.4.0
jupyter-console==5.0.0
jupyter-core==4.2.1
lazy-object-proxy==1.2.2
llvmlite==0.19.0
locket==0.2.0
lxml==3.7.2
Markdown==2.6.8
MarkupSafe==0.23
matplotlib==2.0.2
mistune==0.7.3
mpmath==0.19
multipledispatch==0.4.9
nbconvert==4.2.0
nbformat==4.2.0
networkx==1.11
nltk==3.2.2
nose==1.3.7
notebook==4.3.1
numba==0.34.0
numexpr==2.6.2
numpy==1.13.1
numpydoc==0.6.0
odo==0.5.0
openpyxl==2.4.1
pandas==0.20.3
partd==0.3.7
pathlib2==2.2.0
patsy==0.4.1
pep8==1.7.0
pexpect==4.2.1
pickleshare==0.7.4
Pillow==4.0.0
ply==3.9
prompt-toolkit==1.0.9
protobuf==3.2.0
psutil==5.0.1
ptyprocess==0.5.1
py==1.4.32
pyasn1==0.1.9
pycosat==0.6.1
pycparser==2.17
pycrypto==2.6.1
pycurl==7.43.0
pyflakes==1.5.0
Pygments==2.1.3
pylint==1.6.4
pyOpenSSL==16.2.0
pyparsing==2.1.4
pytest==3.0.5
python-dateutil==2.6.0
pytz==2016.10
PyWavelets==0.5.2
PyYAML==3.12
pyzmq==16.0.2
QtAwesome==0.4.3
qtconsole==4.2.1
QtPy==1.2.1
redis==2.10.5
requests==2.12.4
rope-py3k==0.9.4.post1
scikit-image==0.13.0
scikit-learn==0.19.0
scipy==0.19.1
seaborn==0.7.1
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.10.0
snowballstemmer==1.2.1
sockjs-tornado==1.0.3
Sphinx==1.5.1
spyder==3.1.2
SQLAlchemy==1.1.5
statsmodels==0.8.0
sympy==1.0
tables==3.4.2
tensorboard-pytorch==0.7.1
tensorflow==1.3.0
tensorflow-tensorboard==0.1.4
terminado==0.6
toolz==0.8.2
torch==0.2.0.post2
torchvision==0.1.9
tornado==4.4.2
tqdm==4.15.0
traitlets==4.3.1
unicodecsv==0.14.1
wcwidth==0.1.7
Werkzeug==0.11.15
widgetsnbextension==1.2.6
wrapt==1.10.8
xlrd==1.0.0
XlsxWriter==0.9.6
xlwt==1.2.0


[dexter@Z97X ~/anaconda3/lib/python3.6/site-packages/tensorboard]$ l
crc32c.py     event_file_writer.py  __init__.py   record_writer.py  summary.py  x2num.py
embedding.py  graph.py              __pycache__/  src/              writer.py
[dexter@Z97X ~/anaconda3/lib/python3.6/site-packages/tensorboard]$ pip freeze|grep pytorch
tensorboard-pytorch==0.7.1
[dexter@Z97X ~/anaconda3/lib/python3.6/site-packages/tensorboard]$ 

after `pip install tensorflow-tensorboard==0.1.4`
[dexter@Z97X ~/anaconda3/lib/python3.6/site-packages/tensorboard]$ l
backend/        db.py                 graph.py     pip_package/    __pycache__/      summary.py  webfiles.zip*
crc32c.py       embedding.py          __init__.py  plugins/        record_writer.py  util.py     writer.py
data_compat.py  event_file_writer.py  main.py      plugin_util.py  src/              version.py  x2num.py

The first situation ImportError: cannot import name 'SummaryWriter' is that __init__.py is shadowed by tensorboard. But I can't reproduce the second issue.

Could you try uninstall tensorboard-pytorch 0.7.1, tensorflow then install tensorboardX (0.6.9) and tensorflow (1.3) and see what happens? Thanks

Seems to be working after uninstalling tensorboard-pytorch and installing tensorboardX.
I will do further testing later and comment you the results.

Thanks!

Tested in depth, every functions seems to work perfect! (even adding a graph! :+1: )

Thanks, this can be closed!

Was this page helpful?
0 / 5 - 0 ratings