# Pytorch extension installation

**URL:** <https://discourse.slicer.org/t/pytorch-extension-installation/30929>\
**Category:** Support\
**Created:** [August 2, 2023, 9:56am UTC](https://discourse.slicer.org/t/pytorch-extension-installation/30929 "2023-08-02T09:56:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![KSL](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@KSL](https://discourse.slicer.org/u/KSL)\
**Post date:** [August 2, 2023, 9:56am UTC](https://discourse.slicer.org/t/pytorch-extension-installation/30929/1 "2023-08-02T09:56:25Z")

</div>

Hello, I’ve been using total segmentator in Slicer 5.2.2 for quite sometime. Because of hardware issues, I detete slicer. When I reinstall slicer 5.2.2 and try to run total segmentator,I receive the message “PyTorch 1.8.1 + cpu is not compatible with this module…”. Previously, I’ve been running total segmentator tool with CPU (which is Intel iris Xe graphics) as I do not have dedicated GPU. I need help to fix this problem. Thank you.

 ![Screenshot 2023-08-02 111221](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/6/160cc8615f7f93b16f25d20d91bf9954c52f82d8.jpeg)

---

<div class="post-metadata">

**Author:** ![ebrahim](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ebrahim/32/13403_2.png) [@ebrahim](https://discourse.slicer.org/u/ebrahim)\
**Post date:** [August 2, 2023, 2:53pm UTC](https://discourse.slicer.org/t/pytorch-extension-installation/30929/2 "2023-08-02T14:53:05Z")

</div>

You can use the SlicerPyTorch extension and see if you can configure it to install the correct version.

Or you can generate a pytorch install command from here: [Start Locally | PyTorch](https://pytorch.org/get-started/locally/)

For example setting it to use CPU the pip install command it gives is

```sh
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu

```

so you can achieve this in your slicer python environment by opening the slicer python console and doing the following:

```py
slicer.util.pip_install("torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu")

```

Consider first doing

```auto
slicer.util.pip_uninstall("torch")

```

to remove the old version – idk if it does that automatically

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 2, 2023, 3:04pm UTC](https://discourse.slicer.org/t/pytorch-extension-installation/30929/3 "2023-08-02T15:04:24Z")

</div>

CPU version of PyTorch is fine, you just need more recent PyTorch version than 1.8.1 for current TotalSegmentator version.

---

<div class="post-metadata">

**Author:** ![KSL](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@KSL](https://discourse.slicer.org/u/KSL)\
**Post date:** [August 3, 2023, 10:42am UTC](https://discourse.slicer.org/t/pytorch-extension-installation/30929/4 "2023-08-03T10:42:36Z")

</div>

I have installed PyTorch. However, the same problem persists.

 ![ABC](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/b/dbfbbba669075be9c86d7faba5218d6e077c4a58.png)  
 ![A](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/4/24ed28bf2ce17d1862684e67b2c62027a9cadc38.png)

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [August 3, 2023, 10:46pm UTC](https://discourse.slicer.org/t/pytorch-extension-installation/30929/5 "2023-08-03T22:46:35Z")

</div>

Your screenshot and error message says you are using Slicer 5.2.1. Please try with 5.2.2 (latest stable) and report back.

---

<div class="post-metadata">

**Author:** ![Dex2046](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dex2046/32/65593_2.png) [@Dex2046](https://discourse.slicer.org/u/Dex2046)\
**Post date:** [August 4, 2023, 6:53am UTC](https://discourse.slicer.org/t/pytorch-extension-installation/30929/6 "2023-08-04T06:53:21Z")

</div>

> [@KSL](#):
>
> .

I used slicer5.3，uninstall pytorch, reinstall pytorch as the error message said set version \>=1.12

![屏幕截图 2023-08-04 145235](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/b/dbe4fd36e554b684857785fd3e5730921300b8af.png)

---

<div class="post-metadata">

**Author:** ![KSL](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@KSL](https://discourse.slicer.org/u/KSL)\
**Post date:** [August 4, 2023, 10:39am UTC](https://discourse.slicer.org/t/pytorch-extension-installation/30929/7 "2023-08-04T10:39:02Z")

</div>

Sir, I am using both 5.2.1 and 5.2.2 version. It did not work in both.

 ![Bc](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/1/712114ef8d5e358fbc6131fa7cb406929d102563.png)
