How to locally install the torch module

Please can someone guide me through the installation process of torch module.

Please follow this and do let us know if you face any difficulty.

Already went through this @Ishvinder, however i’ll retry.

What CUDA version are we to take?

You can take 9.2, or any updates as well

Hi, @Ishvinder i have intsalled pytorch locally, but again after running the command import torch or import torchvision getting an error as “OSError: [WinError 126] The specified module could not be found”

As per several other discussions, it seems that your laptop might not have a NVIDIA GPU card, and you’ve installed a CUDA version of Pytorch.

So, shall I need to download 9.2 version of cuda

If you don’t have a NVIDIA GPU, just install any cpu version 9.2 or any new ones.

I am unable to install torch in my local(using pip).I get an error saying ‘No matching distribution found for torch…’.I have followed the official pytorch docs and took the command from there.My python version is 3.8.2 and pip version is 20.1.1 after latest updating.I have tried variations of the command and none works.I get the same error.What could be wrong? Can someone help?

Hi @surabhireshmi,
Seems some kind of version issue, if you’re installing it using pip, please make sure pip has an upgraded version.
Please try this out, or will help you out eith some other solution.
Can you also share a screenshot for reference?

I have already tried after updating pip.Attaching the screenshot.My system is windows 10 and commands are run in git bash(Don’t know if its of any relevance)

Do you have CUDA installed, if yes which version is it?

I did not install cuda .First ,from the pytorch doc i chose cuda 10.2 to get the installation command.Later , I read somewhere that only NVIDIA gpus are cuda supported.My gpu screenshot is attached.So i chose cuda as none to get the command.Both did not work.

If CUDA is not supported, you may check ‘cpu’ installation from pytorch website.


I chose this configuration and tried.Its not working.
I also tried command in this form -> pip install https://download.pytorch.org/whl/cu92/torch-1.5.1%2Bcu92-cp38-cp38-win_amd64.whl

As @Ishvinder said, you’ll have to use PyTorch CPU versions only.

First, uninstall your existing installations by:

pip uninstall torch torchvision 

Then install the CPU build as shown in your screenshot by:

pip install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html

If that doesn’t work, please copy-paste the error that you’re facing when you do the above.

Hi, I was unable to install torch at all.Anyways tried the above .Attaching the screenshot

Can you please try it from your Windows Command Prompt (cmd) instead of MinGW ?

I guess you won’t be able to do it using MinGW since you won’t find cross-builds like that for most packages.
Either use Windows itself, or if you’re on Windows 10, you can try Windows Subsystem for Linux.

In command prompt too it isn’t working.Screenshot given below

Can you please check if your installed Python is 32-bit or 64-bit?

import struct
print(struct.calcsize("P") * 8, "bit")

If it’s 32-bit:
Please ensure it’s 64-bit to install the latest PyTorch builds, by installing the latest 64-bit Python.
(Uninstall the existing Python first to avoid confusion)