Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No module named torch.distributed

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.

like image 652
jahan8409 Avatar asked Aug 14 '26 15:08

jahan8409


1 Answers

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
    
like image 107
Caíque Coelho Avatar answered Aug 16 '26 22:08

Caíque Coelho



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!