Search code examples
pythontensorflowtensorboarddistutils

AttributeError: module 'setuptools._distutils' has no attribute 'version'


I was trying to train a model using tensorboard. While executing, I got this error:

$ python train.py 
Traceback (most recent call last):
  File "train.py", line 6, in <module>
    from torch.utils.tensorboard import SummaryWriter  
  File "C:\Users\91960\AppData\Local\Programs\Python\Python38\lib\site-packages\torch\utils\tensorboard\__init__.py", line 4, in <module>
    LooseVersion = distutils.version.LooseVersion 

AttributeError: module 'setuptools._distutils' has no attribute 'version'.

I'm using python 3.8.9 64-bit & tensorflow with distutils already installed which is required by tensorboard.

Why is this happening?


Solution

  • This command did the trick for me:

    python3 -m pip install setuptools==59.5.0

    pip successfully installed this version:

    Successfully installed setuptools-60.1.0 instead of setuptools-60.2.0