How to get tensorboard working?

I installed PyTorch 1.4 (as confimed by torch.__version__) via conda. I was following the tensorboard tutorial, https://pytorch.org/tutorials/intermediate/tensorboard_tutorial.html#tensorboard-setup.

But this line:

from torch.utils.tensorboard import SummaryWriter

gives me an error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
/data/cossio/apps/anaconda3/envs/bergtorch/lib/python3.7/site-packages/torch/utils/tensorboard/__init__.py in <module>
      1 try:
----> 2     from tensorboard.summary.writer.record_writer import RecordWriter  # noqa F401
      3 except ImportError:

ModuleNotFoundError: No module named 'tensorboard'

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-8-2775babaea59> in <module>
----> 1 from torch.utils.tensorboard import SummaryWriter

/data/cossio/apps/anaconda3/envs/bergtorch/lib/python3.7/site-packages/torch/utils/tensorboard/__init__.py in <module>
      2     from tensorboard.summary.writer.record_writer import RecordWriter  # noqa F401
      3 except ImportError:
----> 4     raise ImportError('TensorBoard logging requires TensorBoard with Python summary writer installed. '
      5                       'This should be available in 1.14 or above.')
      6 from .writer import FileWriter, SummaryWriter  # noqa F401

ImportError: TensorBoard logging requires TensorBoard with Python summary writer installed. This should be available in 1.14 or above.

Note that I did not install tensorboard separately. I thought it came bundled with pytorch? Am I supposed to install it? How?

1 Like

Maybe I have to install tensorboard, but this was not mentioned on the tutorial (or I missed it) and I assumed it was supposed to be available by default when I installed pytorch.

If I must install tensorboard, can I do it through conda? What’s the correct command?

Before a professional person comes here to explain, check out my TensorBoard Colab example!
In fact, there are many hack around for Tensorboard for Pytorch that works!

https://colab.research.google.com/drive/18WgFrJAf7JF9SGaVV12P9OjoSVapD81R

If you are not using it on colab, you can check this one out to install: https://github.com/yunjey/pytorch-tutorial/tree/master/tutorials/04-utils/tensorboard

Please feel free to make a comment on my colab if you want to give an suggestion :sparkling_heart:

1 Like

Thanks. I am not using colab.

Unfortunately this uses pip. I would like to use conda if possible. But before messing with my environment I would like to be sure that I have to install tensorboard separately? Because I thought it was supposed to come bundled with pytorch 1.4.

For future reference, I had to install tensorboard via:

conda install -c anaconda tensorboard
2 Likes