Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'distutils' has no attribute 'version' #12324

Closed
dennisushi opened this issue Mar 14, 2022 · 4 comments
Closed

AttributeError: module 'distutils' has no attribute 'version' #12324

dennisushi opened this issue Mar 14, 2022 · 4 comments
Labels
3rd party Related to a 3rd-party bug Something isn't working

Comments

@dennisushi
Copy link

dennisushi commented Mar 14, 2022

🐛 Bug

Can't import pytorch_lightning > 1.2

from pytorch_lightning.loggers.tensorboard import TensorBoardLogger
  File "/home/dennisushi/miniconda3/envs/calvin_venv/lib/python3.8/site-packages/pytorch_lightning/loggers/tensorboard.py", line 26, in <module>
    from torch.utils.tensorboard import SummaryWriter
  File "/home/dennisushi/miniconda3/envs/calvin_venv/lib/python3.8/site-packages/torch/utils/tensorboard/__init__.py", line 4, in <module>
    LooseVersion = distutils.version.LooseVersion
AttributeError: module 'distutils' has no attribute 'version'

Works OK with ==1.2.

Expected behavior

No error

  • PyTorch Lightning Version: 1.3.0-1.5.10
  • PyTorch Version: 1.8-1.11
  • Python version: 3.8
  • OS (e.g., Linux):
  • CUDA/cuDNN version:
  • GPU models and configuration:
  • How you installed PyTorch (conda, pip, source): pip3
  • Any other relevant information: in a Conda environment with these pip setup.py install requirements (not through conda)
cmake
wheel
numpy>1.2
hydra-core==1.1.1
hydra-colorlog
matplotlib
opencv-python
omegaconf
plotly
#pyhash
pytorch-lightning==1.4.9
torch==1.10.0
torchvision
#MulticoreTSNE
gitpython
scipy
sentence-transformers
setuptools==57.5.0
gym
moviepy
tqdm
termcolor
wandb
@akihironitta
Copy link
Contributor

akihironitta commented Mar 14, 2022

I think pytorch/pytorch#69894 is the cause. I experienced the error before, and I remember using a different version of setuptools fixed the error. (I can't find the exact issue I saw before...)


Can you try conda install setuptools=58.2.0? (which is commented in facebookresearch/detectron2#3811 (comment))

@akihironitta akihironitta changed the title Import Error - distutils version AttributeError: module 'distutils' has no attribute 'version' Mar 14, 2022
@akihironitta akihironitta added the bug Something isn't working label Mar 15, 2022
@rohitgr7 rohitgr7 added the 3rd party Related to a 3rd-party label Mar 16, 2022
@akihironitta
Copy link
Contributor

@dennisushi Also, I remember the patch for this issue have been resolved in the PyTorch 1.11, so if you're okay with trying out the new version, I'd suggest doing so. Feel free to reopen this issue if the problem still persists.

@joaoplay
Copy link

@dennisushi Also, I remember the patch for this issue have been resolved in the PyTorch 1.11, so if you're okay with trying out the new version, I'd suggest doing so. Feel free to reopen this issue if the problem still persists.

I was experiencing the same issue. Solved after upgrading to PyTorch 1.11. Thank you!

@SuDaxia-kai
Copy link

@dennisushi I encounter the same issue in torch==1.10.0. It was solved after upgrading to Pytorch 1.11.0. Thank you!
pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party Related to a 3rd-party bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants