2
votes

I am getting the following error when importing torchvision.

Detected that PyTorch and torchvision were compiled with different CUDA versions. PyTorch has CUDA Version=11.0 and torchvision has CUDA Version=10.1. Please reinstall the torchvision that matches your PyTorch install.

How can I change the cuda version of pytorch to 10.1?

'conda install pytorch torchvision cudatoolkit=10.1-c pytorch' from anaconda prompt I get the same error even if I do it.

I am using windows10, and I am using python version 3.7 in the virtual environment of jupyter notebook.

1
cudatoolkit=10.1-c pytorch, is that a typo?Ivan
Is there something wrong? Even if it says 'conda install pytorch torchvision cudatoolkit=10.1-c pytorch', it was installed.오렌지보드orange_cbt4
You might not be able to install it with a different version because it's already installed. Maybe try to uninstall it with conda uninstall pytorch torchvision and install it back with conda install pytorch torchvision cudatoolkit=10.1 -c pytorch.Ivan
I haven't thought about deleting and reinstalling. Doing the same as you told me, solved the problem. Thank you very much.오렌지보드orange_cbt4

1 Answers

1
votes

Uninstalling and installing it back might work

!conda uninstall pytorch torchvision

With:

!conda install pytorch torchvision cudatoolkit=10.1 -c pytorch