Cannot import name 'VOCSegmentation' from 'torchvision.datasets'

Hi, I was working on Voc dataset. But when I tried to download the dataset I got the following error.

cannot import name 'VOCSegmentation' from 'torchvision.datasets

I found that the version of torchvision that I use is : 0.2.0 and Voc dataset is available in torchvision with version: 0.6.1

Then I removed torchvision from site-packages and installed it using the following command:

conda install torchvision==0.6.1 cudatoolkit=10.2 -c pytorch

But when I install the torchvision of version 0.6.1, pytorch is also reinstalled automatically with version 1.5.1, while before reinstalling torchvision I was working with updated version of pytorch.

Is there any way that I can install the newer version of torchvision but I do not have to downgrade to older version of pytorch?

Yes, you could install the latest stable torchvision (and PyTorch) release by removing the version specification:

conda install pytorch torchvision cudatoolkit=10.2 -c pytorch

Ok, thank you for your answer.