How to solve ModuleNotFoundError: No module named 'torch.utils.tensorboard'

Greetings,
I’m trying to carry out the Tutorial : Visualizing Models, Data, and Training with TensorBoard

But in chapter 1.tensorboard setup I have an issue with the line
“from torch.utils.tensorboard import SummaryWriter” which gives the error mentionned above.

I tried to update both Pytorch and tensorboard (Pip says that tensorboard is already installed…)

Does any of you have a solution to this problem ?
Thanks

Hi,

What is the value of torch.__version__?

The version is 0.4.0

This is what Pip says :slight_smile:pip search torch
torch-vision (0.1.6.dev0) - image and video datasets and models for torch deep learning
torch (1.3.0.post2) - Tensors and Dynamic neural networks in Python with strong GPU acceleration
INSTALLED: 1.3.0
LATEST: 1.3.0.post2
deepctr-torch (0.1.3) - Easy-to-use,Modular and Extendible package of deep learning based CTR(Click
Through Rate) prediction models with PyTorch
fcd-torch (1.0.7) - Fréchet ChemNet Distance on PyTorch
torch-layers (0.1.2) -
torch-inspect (0.0.3) - Utility functions that prints a summary of a model.
torch-geometric (1.3.2) - Geometric Deep Learning Extension Library for PyTorch
torch-tagger (0.0.61) - NLP tool
torch-ssd (1.2.0) - High quality, fast, modular reference implementation of SSD in PyTorch
torch-buddy (0.0.5) - pytorch toolkit
torch-sparse (0.4.3) - PyTorch Extension Library of Optimized Autograd Sparse Matrix Operations
torch-radiate (0.0.1) - Automatic deep learning research report generator
torch-testing (0.0.2) - A collection of assertion methods to compare PyTorch Tensors in tests
torch-scatter (1.3.2) - PyTorch Extension Library of Optimized Scatter Operations
torch-encoding (1.0.1) - PyTorch Encoding Package
bayes-torch (0.0.4) - A light weight bayes inference framework based on pytorch.
torch-gpipe (0.0.0a0) -
torch-cluster (1.4.5) - PyTorch Extension Library of Optimized Graph Cluster Algorithms
torch-hypothesis (0.1.1) - Generate pytorch data structures for the hypothesis testing library.
torch-trainer (0.1) - Bare bones PyTorch training utility
torch-tools (0.0.11) - A library of helpers to train, evaluate and visualize deep nets with PyTorch.
torch-ac (1.1.0) -
torch-light (1.0.0) - A mini framework for pytorch
torch-transformer (0.18.1) - Transformer implemented in PyTorch
torch-salad (0.2.1a0) - Semi-supervised Adaptive Learning Across Domains
torch-mtcnn (0.0.7) - Implementation of MTCNN using Pytorch.
torch-lp (0.1.3) - quantization simulation tools for Pytorch
torch-scope (0.5.4) - A Toolkit for Training, Tracking and Saving PyTorch Models
torch-stft (0.1.4) - An STFT/iSTFT for PyTorch
gluoncv-torch (0.0.3) - MXNet Gluon CV Toolkit
torch-flame (0.1.0) - A deep learning utility library for PyTorch
torch-helpers (0.4.6) - A set of helper functions for pyTorch
k-torch (0.1.0) - A Keras-like wrapper for PyTorch
my-torch (0.0.1) - A transparent boilerplate + bag of tricks to ease my (yours?) (our?) PyTorch
dev time.
torch-unique (1.0.3) - Optimized PyTorch Unique Operation
torch-stethoscope (0.0.1) - Automatic deep learning research report generator
rpi3.torch (0.1.0) - PyTorch in Raspberry Pi3 B, py35, armv7l
torch-es (0.0.1) - Double Seasonal Exponential Smoothing using PyTorch + ES-RNN capabilities on
top
torch-utils (0.1.2) - Common Utils for PyTorch
torch-eunn (0.2.0) - An Efficient Unitary Neural Network implementation for PyTorch
torch-dct (0.1.5) - Discrete Cosine Transform (DCT) for pytorch
torch-raspi (0.4.0) - PyTorch for Raspberry Pi 3B armv7l
torch-bincount (0.1.1) - Optimized PyTorch BinCount Operation
torch-crypto (0.1.1) - Command-line Cryptanalysis
rlgarage-torch (0.1.0) -
torch-kerosene (0.1.0) - Deep Learning framework for fast and clean research development with Pytorch
torchlight (0.0.1) - Torch Light
torch-position-embedding (0.7.1) - Position embedding implemented in PyTorch
torch-basic-models (0.2.8) - Basic Models for PyTorch, with Unified Interface
torch-spline-conv (1.1.1) - Implementation of the Spline-Based Convolution Operator of SplineCNN in
PyTorch
torch-gpt-2 (0.3.0) - GPT-2 implemented in PyTorch
torch-layer-normalization (0.10.2) - Layer normalization implemented in PyTorch
torch-lr-scheduler (0.0.6) - PyTorch Optimizer Lr Scheduler
torch-text-classifier (0.0.58) - NLP tool
torch-baidu-ctc (0.3.0) - PyTorch bindings for Baidu Warp-CTC
torch-model-state (0.0.9) - PyTorch Model State Save & Load
torch-parameter-groups (0.0.5.post1) - Group PyTorch Parameters according to Rules
torch-lr-finder (0.0.1) - Pytorch implementation of the learning rate range test
torch-embed-sim (0.3.2) - Embedding similarity implemented in PyTorch
ergo-pytorch (1.1.1) - making torch even better.
torchrs (0.2.3) - Torch dependencies management tool
lutorpy (1.3.7) - Python wrapper for torch and Lua/LuaJIT
torch-multi-head-attention (0.15.1) - Multi-head attention implemented in PyTorch
torchure (0.0.14) - A collection of small functions that supplements torch functionality
torchfun (1.0.82) - A collection of functions/classes that supplements torch functionality.
visdom (0.1.8.9) - A tool for visualizing live, rich data for Torch and Numpy
torchvision (0.4.1.post2) - image and video datasets and models for torch deep learning
INSTALLED: 0.4.1
LATEST: 0.4.1.post2
torchcv (0.0.2) - image and video datasets and models for torch deep learning
tnet (0.0.1a1) - Torch and torchnet like library for building and training neural networks in
Theano
pystencils-autodiff (0.2.2) - Automatic differentiation and generation of Torch/Tensorflow operations with
pystencils (https://i10git.cs.fau.de/pycodegen/pystencils)

Hi,

tensorboard has been added recently. So you would need to upgrade your pytorch version to have access to it.

I’ve just upgraded it (even though I thought I had already done it)
now version is 1.0.1 and it still doesn’t work…
I used “conda update pytorch” to upgrade.

You might want to upgrade your conda as well. The latest version is 1.3.
Some of our dependencies require a recent conda, so upgrading conda should let you upgrade pytorch to 1.3.

Sometimes I feel like development is all about updating stuffs… lol
I’ll do that thank you very much!

My mistake, I updated it with Pip

Everything is up to date now :
tensorboard 2.0.0
tensorboardX 1.5
torch 1.3.0
torchtext 0.3.1
torchvision 0.4.1

yet I’m still facing the same problem.
(I’ve also restarted the computer.)

Could it be possible that I have 2 versions of PyTorch on my computer : 1 installed via Pip and 1 via conda ?

Hi,

Yes it’s possible. If you’re inside a conda environment. I would advise not to use pip unless a conda package is not available.
You can pip uninstall torch and conda uninstall torch (not sure if it’s the right conda command to uninstall). And run these until you don’t have pytorch. Then install just one.

what is the latest version of pytorch that does not show this error?

The latest stable version is 1.4 and you can import it as from torch.utils import tensorboard.

sorry I meant what is the earliest version that supports it.