Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
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 is already installed which is required by tensorboard.
Why is this happening ? Please help !
This is a known bug which has been patched:
https://github.com/pytorch/pytorch/pull/69904
You can either use the nightly-release of PyTorch, or otherwise downgrade setup tools to
setuptools
version
59.5.0
:
pip install setuptools==59.5.0
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
For anyone needing to use older versions of PyTorch, such as NVidia Jetson TX2 users building PyTorch 1.10.0 for newer python version, it is simpler to add the missing import to the setup.py file:
import distutils.version
... This should be added after the future import. The same trick should work for other projects, as this ensures that distutils.version is available, where it was previous automatically imported by setuptools.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.