Unable to install Pytorch on windows 10

I am trying to install pytorch on Windows 10 using the below code

conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch

But I am getting the below shared error

(base) C:\Users\dalvi>conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: /
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.

It is causing conflict

Below is the Cudatoolkit version
Name - cudatoolkit
Version - 9.0
Build - 1
Channel - anaconda

Below is the Cudnn version
Name - cudnn
Version - 7.6.0
Build - cuda9.0_0

I am Nvidia GeForce RTX 3050 on my laptop.

Please let me know where am I going wrong.

The 3050 would need CUDA>11, so you should use:

conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge

If that’s also creating conflicts in your environment, create a new one and try to reinstall it there.

Thanks for your response. I have created a new environment and it did worked. But now when I am trying to built a model using pretrained resnet152 to classify images as dog or cat, I am getting the below shared error

RuntimeError: cuDNN error: CUDNN_STATUS_INTERNAL_ERROR
You can try to repro this exception using the following code snippet. If that doesn’t trigger the error, please include your original repro script when reporting this issue.

import torch
torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.benchmark = True
torch.backends.cudnn.deterministic = False
torch.backends.cudnn.allow_tf32 = True
data = torch.randn([8, 3, 224, 224], dtype=torch.float, device=‘cuda’, requires_grad=True)
net = torch.nn.Conv2d(3, 64, kernel_size=[7, 7], padding=[3, 3], stride=[2, 2], dilation=[1, 1], groups=1)
net = net.cuda().float()
out = net(data)
out.backward(torch.randn_like(out))
torch.cuda.synchronize()

ConvolutionParams
data_type = CUDNN_DATA_FLOAT
padding = [3, 3, 0]
stride = [2, 2, 0]
dilation = [1, 1, 0]
groups = 1
deterministic = false
allow_tf32 = true
input: TensorDescriptor 000001EEFAEB3EB0
type = CUDNN_DATA_FLOAT
nbDims = 4
dimA = 8, 3, 224, 224,
strideA = 150528, 50176, 224, 1,
output: TensorDescriptor 000001EEFAEB3F20
type = CUDNN_DATA_FLOAT
nbDims = 4
dimA = 8, 64, 112, 112,
strideA = 802816, 12544, 112, 1,
weight: FilterDescriptor 000001EEF64CF9E0
type = CUDNN_DATA_FLOAT
tensor_format = CUDNN_TENSOR_NCHW
nbDims = 4
dimA = 64, 3, 7, 7,
Pointer addresses:
input: 0000000505400000
output: 0000000560400000
weight: 000000054F3E9000

Can you tell me where am I going wrong?

This might be a cuDNN issue. I assume you are using the torchvision.models.resnet152 with an input shape of [8, 3, 224, 224] and are using the latest PyTorch release?
If so, I’ll try to find a similar device and try to reproduce it.

Yes I am using torchvision.models.resnet152 with an input shape of [8, 3, 224, 224]. I am not sure when you say latest Pytorch release? I have installed pytorch using conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge which you have shared above so I am assuming the latest release.

Also now I am getting the below shared error now.

RuntimeError: CUDA out of memory. Tried to allocate 1.10 GiB (GPU 0; 4.00 GiB total capacity; 518.64 MiB already allocated; 1.73 GiB free; 564.00 MiB reserved in total by PyTorch)

Request your help on this as well

Thanks for the update. Could you lower the memory requirement, as you are apparently running out of memory and cuDNN might just be running into a sticky error?

How do I lower the memory requirement? Should I decrease the batch size?

Yes, decreasing the batch size would be a simple way to decrease the memory usage.
Another way could be to use e.g torch.utils.checkpoint to trade compute for memory or, if possible, decrease the spatial size of the inputs etc. (but this depends on the model).