Install pytorch GPU version in Slicer

I am trying to install pytorch GPU version in Slicer but I can only install the CPU version. I can successfully install pytorch GPU in a external python but running the same pip commands in the Slicer’s python I only get the CPU one.
Do you know how to solve it?

Thank you

1 Like

remove all packages you installed, and follow the instructions in here.
Choosing correct versions of OS, package manager and cuda versions installed on your system.

then instead of installing with pip (if you are on Linux), just download the appropriate wheels for your system. (i.e., ignore the first part, and follow the second part that goes

for example if you are on linux and you have cuda 11.6 installed this would be the one of the appropriate package (since Slicer uses python 3.9) if your goal is to use torch 1.12

once those are downloaded, open Slicer go to python interactor and install via

1 Like

Additionally there is the SlicerPyTorch extension (should be in the extension manager). It uses light-the-torch under the hood, so you could also just go ahead use light-the-torch yourself to help fetch and install the correct wheel for your hardware


I wasn’t aware of this. This look really cool. will give it a try.

1 Like