2
votes

ImportError: No module named torch.distributed

File "train.py", line 4, in <module>
    import torch.distributed as dist
ImportError: No module named torch.distributed

I installed CUDA AND cuDNN then created env and installed pip3 install torch torchvision but getting error.

1
Did you remember to activate your virtual environment? - Acoop
Yes I activated virtual environment - jahan8409

1 Answers

1
votes

This works for me:

  1. Create a conda virtual environment:

    conda create -n env_pytorch python=3.6
    
  2. Active this environment create above:

    source activate env_pytorch
    
  3. Install PyTorch with pip or pip3:

    pip install torchvision --user