How to use Tensorboard with PyTorch?

I’m using the conda package manager: I installed pytorch the recommended way using

conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

Now I tried to use tensorboard. I tried both

https://anaconda.org/conda-forge/tensorboard

and

https://anaconda.org/anaconda/tensorboard

the first one installs version 1.14 which gives me “FutureWarning” errors, while the second one installs version 2.0 (which is also the version that is installed when using pip) but gives me a “Unable to reload accumulator” error. How do I correctly install tensorboard in conda?

Hi,

Tensorboard is now builtin with pytorch. See the doc: https://pytorch.org/docs/stable/tensorboard.html

Thanks for your answer: Yes, some part is, but as far as I understand we still need to install something external to to display the summary files - in the link you provided it says

This can then be visualized with TensorBoard, which should be installable and runnable with:

pip install tensorboard
tensorboard --logdir=runs

Are you saying that it is not necessary to do that even if you want to display the results?

Right, you need that for the visualization.
It is very unexpected that pip install tensorboard does not work for you. Can you give more informations about the error?

I’m using conda - not pip - as my package manager. With the first version (from conda-forge) I get the old version (1.14) of tensorboard which gives me these “FutureWarning” errors, I think from numpy. While it works it seems it is not gonna be supported for much longer.

That is why I tried to use the new version (2.0, which is the same version you currently get with pip, so I expected it is gonna behave the same), but I got the error mentioned. Now yesterday this package was updated again and after installing the new updated package (still version 2.0) the error disappeared, so I guess it must have been an error on their side.

Thanks for answering anyway!

1 Like

Hi @pyscorcher and @albanD, this solution does not work for me. I have torch version 1.2.0 and installed with conda tensorboard 2.0.2. I am running on Sagemaker conda_pytorch_p36. I also followed this stackoverflow question.

from torch.utils.tensorboard import SummaryWriter

returns the following error:

TypeError: __new__() got an unexpected keyword argument 'serialized_options'

Any suggestions? Somebody solved this issue? I am losing hope :frowning_face:

If you uninstall tensorboard (and just have pytorch installed), do you still get this error? As long as you don’t run tensorboard I don’t think this is what is causing your error (so I guess this is the wrong thread to ask this), as SummaryWriter is part of pytorch itself. As always I recommend starting with a fresh installation with the bare minimum you need.
Maybe protobuf is your problem? https://stackoverflow.com/questions/50338968/objectdetecionapi-typeerror-new-got-an-unexpected-keyword-argument-seria

It seems tensorboad needs to be installed. I tried downgrading protobuf to version 3.6.0 but the issue remained