How to solve ModuleNotFoundError: No module named 'tensorboardX'?

For this line (in Python 2.7.10):

from tensorboardX import SummaryWriter

I am getting this error:

ModuleNotFoundError: No module named 'tensorboardX'

I installed:
$ pip install tensorboardX

and the result for pip list|grep tensor:

tensorboard          1.13.1         
tensorboardX         1.7            
tensorflow           1.13.1         
tensorflow-estimator 1.13.0

Any ideas how can I solve this error?

1 Like

Are you using Pycharm ?
If so, try restarting it or directly run the program and see if it works.

I had this issue , but got fixed after restarting pycharm.

If you are using the latest PyTorch version (1.1.0), tensorboard support is now integrated, using the same API as tensorboardX. You can call it with from torch.utils.tensorboard import SummaryWriter, so that you don’t need an external library.

If indeed you run in PyCharm and haven’t restarted yet, try @bigmb’s solution.

@alex.veuthey have you tried visualizing Unet models in pytorch(1.1.0) ? Because for me it works for simple configuration but if it has skip connection then it shows me error, but the same model works in tensorboardX.

That’s good to know! I haven’t tried yet. The link says “It also currently does not support all model types for add_graph , which we are actively working on.” so I guess that explains it…

@bigmb @alex.veuthey thank you for your reply.

@bigmb I don’t use Pycharm. I used Python and also Jupyter notebook.
@alex.veuthey I upgraded torch version to 1.1.0, and tried from torch.utils.tensorboard import SummaryWriter but it gave the same error.

@Niki : just make sure that if you using anaconda , then you are installing it in conda and not in python. Also, check if the python you are using is linked to the site-packages.

Ok. Thank you for your help @bigmb.