Reputation: 351
I have tried to install python torch by using
!pip install torch
But I got the error OSError: [WinError 126] The specified module could not be found
Then I tried with
pip install torch -f https://download.pytorch.org/whl/torch_stable.html
The running log is as follows,
Then I have installed the torch by the below command to install the CPU version of the torch.
pip install torch==1.7.1+cpu torchvision==0.8.2+cpu torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
Then, when I try to test by the command,
import torch
print(torch.__version__)
In the Spyder, it still could not recognize,
However, in python.exe it could recognize and provides the correct output.
Upvotes: 1
Views: 4019
Reputation: 352
Ok the problem is that you are trying to install the cuda version of Pytorch on a non cuda enabled computer. You can find a similar problem here. You have to download the cpu version of pytorch like this
pip install torch==1.7.1+cpu torchvision==0.8.2+cpu torchaudio===0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
Upvotes: 1