# Monai server launch failing

**URL:** https://discourse.slicer.org/t/monai-server-launch-failing/23757
**Category:** Support
**Tags:** python, monai
**Created:** [June 7, 2022, 8:00pm UTC](https://discourse.slicer.org/t/monai-server-launch-failing/23757 "2022-06-07T20:00:33Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Nayra\_Pumar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nayra_pumar/32/12688_2.png) [@Nayra\_Pumar](https://discourse.slicer.org/u/Nayra_Pumar)
#### Post date: [June 7, 2022, 8:00pm UTC](https://discourse.slicer.org/t/monai-server-launch-failing/23757/1 "2022-06-07T20:00:33Z")

</div>

I’ve cloned the MONAIlabel github repository ([GitHub - Project-MONAI/MONAILabel: MONAI Label is an intelligent open source image labeling and learning tool.](https://github.com/Project-MONAI/MONAILabel)), set up a python 3.9 python environment, installed cuda and then installed all the dependencies listed in the dependencies.txt from the github repository (by running` pip install -r requirements.txt` in the terminal).

When I try to start the server it fails to run, and I get this error message:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/c/cc3ec1d59af3d032d78d816f25b017bd1836f1ab.png)

It’s running on a computer running windows 10. A ‘twin’ of this computer runs the MONAIlabel server flawlessly, and even a laptop (without cuda possibilities) has managed to start the server. All of these instalations following the same procedure.

---

<div class="post-metadata">

### Author: ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)
#### Post date: [June 8, 2022, 2:39am UTC](https://discourse.slicer.org/t/monai-server-launch-failing/23757/2 "2022-06-08T02:39:27Z")

</div>

It looks like you might be missing the `segmentation.py` file in `apps/radiology/lib/configs/`. Does that file exist in that location?

---

<div class="post-metadata">

### Author: ![Nayra\_Pumar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nayra_pumar/32/12688_2.png) [@Nayra\_Pumar](https://discourse.slicer.org/u/Nayra_Pumar)
#### Post date: [June 8, 2022, 7:33am UTC](https://discourse.slicer.org/t/monai-server-launch-failing/23757/3 "2022-06-08T07:33:56Z")

</div>

Yes, the file segmentation.py exists in the folder. I’ve just checked taking he segmentation.py from the laptop where the server worked, and replacing the one in the computer where it doesn’t work, and no success.

---

<div class="post-metadata">

### Author: ![mikebind](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mikebind](https://discourse.slicer.org/u/mikebind)
#### Post date: [June 8, 2022, 3:43pm UTC](https://discourse.slicer.org/t/monai-server-launch-failing/23757/4 "2022-06-08T15:43:31Z")

</div>

I’m quite a beginner with MONAILabel, so I don’t really have other ideas about the best way to troubleshoot. My thought was based on trying to interpret the error stack trace you shared. It looks like it was in the middle of loading a series of subclasses and successfully got through ones for deepedit, deepgrow\_2d, deepgrow\_3d, then ran into an error trying to load the same kind of thing for “segmentation”. It looks like the error message is suggesting that it is failing to find a `segmentation.py` file in `lib/configs/` which has a `Segmentation` class defined in it derived from `TaskConfig`. If that file is there, then I wonder if perhaps some other configuration is pointing it to a different place or if something was renamed. For example, might you have renamed one of the models in order to customize it? Or, did you clone the github repo at different times on the two different computers? Might the repo have changed in between? Those are the only ideas I have which might be helpful.  
@diazandr3s do you have any suggestions?

---

<div class="post-metadata">

### Author: ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)
#### Post date: [June 8, 2022, 4:12pm UTC](https://discourse.slicer.org/t/monai-server-launch-failing/23757/5 "2022-06-08T16:12:36Z")

</div>

In WSL Ubuntu I always cd to my home dir to which I forked MONAILabel and do a

```auto
export PATH=$PATH:`pwd`/MONAILabel/monailabel/scripts

```

in the home directory before I start monailabel server.  
Does this maybe help?

---

<div class="post-metadata">

### Author: ![diazandr3s](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/diazandr3s/32/9973_2.png) [@diazandr3s](https://discourse.slicer.org/u/diazandr3s)
#### Post date: [June 8, 2022, 7:18pm UTC](https://discourse.slicer.org/t/monai-server-launch-failing/23757/6 "2022-06-08T19:18:16Z")

</div>

Thanks for your comments, @mikebind, @rbumm  
@Nayra_Pumar please set the path as @rbumm suggested and let us know how that goes.

---

<div class="post-metadata">

### Author: ![Nayra\_Pumar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nayra_pumar/32/12688_2.png) [@Nayra\_Pumar](https://discourse.slicer.org/u/Nayra_Pumar)
#### Post date: [June 9, 2022, 12:09pm UTC](https://discourse.slicer.org/t/monai-server-launch-failing/23757/7 "2022-06-09T12:09:54Z")

</div>

> [@rbumm](#):
>
> `export PATH=$PATH:`pwd`/MONAILabel/monailabel/scripts`

I tried installing, on a different computer, with a cuda capable GPU, following the same instructions. I launched the server using the same command and everything worked fine at the first time.  
So I figured the error was related to the computer. I reinstalled windows 11 from scratch, and in that fresh installation, I tried to install again the monai label (installing git, anaconda, creating a new environment…).  
Again I still get the same error. I don’t think it’s a path problem, because I haven’t had to set it on the other two different computers where I tried to do the installation.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/3/83a1d22d5fa78f89efe9628ef6d51bbf944a2fdf.png)

Also I’ve tried to find info about the uvicorn error 56 and had no luck.

---

<div class="post-metadata">

### Author: ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)
#### Post date: [June 9, 2022, 2:46pm UTC](https://discourse.slicer.org/t/monai-server-launch-failing/23757/8 "2022-06-09T14:46:46Z")

</div>

Thanks, Nayra.  
I did the same process a few days ago in windows 11 without using anaconda.

Install a Python 3.9 (important, not 3.10) from the Windows store.  
Please try to install MONAILabel and its prerequisites [as outlined here]  
([Installation — MONAI Label 0.7.0rc1 Documentation](https://docs.monai.io/projects/label/en/latest/installation.html#windows)) using pip in the PowerShell as admin.

```auto
python -m pip install --upgrade pip setuptools wheel

```

then refer [to this page](https://pytorch.org/get-started/locally/) to get the current PyTorch and Cuda script and run it

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/8/589655f921e882f41f3554ec5164ed5194b90711.png)

```auto
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113

```

Change to your user home directory and run

```auto
pip install git+https://github.com/Project-MONAI/MONAILabel#egg=monailabel

```

to install the latest version of ML.  
Download ML apps and dataset as outlined in the documentation link above and run the start\_server script line.  
Hope that helps …

---

<div class="post-metadata">

### Author: ![Nayra\_Pumar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nayra_pumar/32/12688_2.png) [@Nayra\_Pumar](https://discourse.slicer.org/u/Nayra_Pumar)
#### Post date: [June 10, 2022, 1:49pm UTC](https://discourse.slicer.org/t/monai-server-launch-failing/23757/9 "2022-06-10T13:49:39Z")

</div>

Thank you @rbumm

Following your advice I installed python 3.9 from the Microsoft Store, followed the instructions from the [monai.io](http://monai.io) page, installed the custom version of PyTorch+Cuda all of that using the PowerShell as admin.  
To install the monail label, I cloned the github repository and, in the home directory, ran:

` pip install -r requirements.txt`

to get all the needed packages installed.  
Downloaded the dataset and I was able to run the server and connect to it from Slicer!

I think what did the trick was not to use anaconda.

Thank you very much for your help!
