ImportError: No module named torchvision.transforms

l have installed pytorch as follow :

git clone && cd pytorch/
python install

It have been installed successfully.
these commands works :

import torch
from import Dataset
from import sampler

However :

import torchvision.transforms as transforms

gives me back the following error :

ImportError: No module named torchvision.transforms

What’s missing ?



Build PyTorch from source

RUN git clone
&& 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 install
&& rm -rf pytorch

Build torch-vision from source

RUN git clone
&& cd vision
&& git checkout 83263d8571c9cdd46f250a7986a5219ed29d19a1
&& python 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: