Monai server launch failing

I’ve cloned the MONAIlabel github repository (GitHub - Project-MONAI/MONAILabel: MONAI Label is an intelligent open source image labeling and learning tool.), 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

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.

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

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.

2 Likes

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?

1 Like

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

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

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

2 Likes

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

1 Like

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

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

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) using pip in the PowerShell as admin.

python -m pip install --upgrade pip setuptools wheel

then refer to this page to get the current PyTorch and Cuda script and run it

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

Change to your user home directory and run

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 …

Thank you @rbumm

Following your advice I installed python 3.9 from the Microsoft Store, followed the instructions from the 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!

2 Likes