ImportError: TensorBoard logging requires TensorBoard version 1.15 or above

import torch

import torch.nn as nn

import torch.nn.functional as F

import torch.optim as optim

import torchvision

import torchvision.transforms as transforms

After that, when I type

import torch.utils.tensorboard

This gives the import error. I tried to solve this error by googling here and stackoverflow. I have created a new environment via Conda and installed the stable PyTorch (1.12) and the latest Tensorboard, but does not work for me. Any advice would be greatly appreciated.

I cannot reproduce the issue in PyTorch 1.12.0 after installing tensorboard via pip install tensorboard. Before installing it I get the expected import error:

ModuleNotFoundError: No module named 'tensorboard'

Hi ptrblck,

Thanks for your reply. I use Anaconda Python, so installed both pt and tb using conda, not pip. Would you suggest installing tb using pip instead? Let me create a new environment and do so. If you could, would you specify python, pt, and tb versions? I would really appreciate it.

I created a new Conda env (Python=3.8), installed pt 1.12 and then pip-installed tensorboard (2.9.1). Unfortunately, I still get the same import error.

I solved the issue after reading this

I accidentally had “tensorboard.py” in the folder of the ipynb files that I have been working on. I do not remember whether or when I created it purposely, though. I hope this posting would help others who could be in the same istuation as mine. I spent the two full days doing everything (uninstall, reinstall, create a new env, install using pip, install tb-nightly, etc.). Thanks ptrblck for your reply as well.

1 Like