ImportError: No module named torchvision.transforms

Hello,
l have installed pytorch as follow :

git clone https://github.com/pytorch/pytorch.git && cd pytorch/
python setup.py install

It have been installed successfully.
these commands works :

import torch
from torch.utils.data import Dataset
from torch.utils.data import sampler

However :

import torchvision.transforms as transforms

gives me back the following error :

ImportError: No module named torchvision.transforms

What’s missing ?

THANK YOU

Torch

Build PyTorch from source

RUN git clone https://github.com/pytorch/pytorch.git
&& cd pytorch
&& git checkout 4eb448a051a1421de1dda9bd2ddfb34396eb7287
&& TORCH_CUDA_ARCH_LIST=“3.5 5.2 6.0 6.1+PTX”
TORCH_NVCC_FLAGS="-Xfatbin -compress-all"
python setup.py install
&& rm -rf pytorch

Build torch-vision from source

RUN git clone https://github.com/pytorch/vision.git
&& cd vision
&& git checkout 83263d8571c9cdd46f250a7986a5219ed29d19a1
&& python setup.py install
&& rm -rf vision

Thanks a lot @QuantScientist. It works. However, l didn’t install “Build torch-vision from source” l just installed pytorch “Build PyTorch from source” then import torchvision.transforms as transforms works. It’s strange

git checkout worked properly but while setting up
TORCH_CUDA_ARCH_LIST=“3.5 5.2 6.0 6.1+PTX”

5.2: command not found

There is an updated script here: