When I import torchvision, I get an error that the cuda version of pytorch and torchvision are different

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.

Upvotes: 2

Views: 2894

Answers (1)

Ivan
Ivan

Reputation: 40778

Uninstalling and installing it back might work

!conda uninstall pytorch torchvision

With:

!conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

Upvotes: 1

Related Questions