I"m going through this tutorial to set up pytorch (v1.3.0 through conda) with tensorboard https://pytorch.org/tutorials/intermediate/tensorboard_tutorial.html#
but on the step
from torch.utils.tensorboard import SummaryWriter
# default `log_dir` is "runs" - we'll be more specific here
writer = SummaryWriter('runs/fashion_mnist_experiment_1')
I keep getting the error
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
C:\ProgramData\Anaconda3\envs\fastai_v1\lib\site-packages\torch\utils\tensorboard\__init__.py in
1 try:
----> 2 from tensorboard.summary.writer.record_writer import RecordWriter # noqa F401
3 except ImportError:
ModuleNotFoundError: No module named 'tensorboard.summary'; 'tensorboard' is not a package
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
c:\Users\matt\Documents\code\playground\tensorboard.py in
----> 1 from torch.utils.tensorboard import SummaryWriter
2
3 # default `log_dir` is "runs" - we'll be more specific here
4 writer = SummaryWriter('runs/fashion_mnist_experiment_1')
C:\ProgramData\Anaconda3\envs\fastai_v1\lib\site-packages\torch\utils\tensorboard\__init__.py in
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.
Does anyone have any suggestions?
The error log says, among other things,
ImportError: TensorBoard logging requires TensorBoard with Python summary writer installed. This should be available in 1.14 or above.
So, when it tries to import TensorBoard, it's unable to do so because it's missing it in the search path. You can install the latest version (without specifying any version number), as in:
$ conda install -c conda-forge tensorboard
Apart from that, you might also need to install protobuf:
$ conda install -c conda-forge protobuf
These installations should fix the ImportError
s.