MONAILabel cannot connect: ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

Hello,
I have tried running the MONAILabel module but keep getting a connection refused error.

image

At first, I suspected the firewall to be the reason and allowed the slicer.exe app through the window firewall on the control panel.

However, it still did not work.

So next thing I checked was the port number.

I found out that the default server was serving at http://127.0.0.1:8000/.

When I checked my computer with the command below, port number 8000 did not exist.

netstat -an|findstr 8000

So I am wondering not having the port can be the reason for this error and how to solve it.

Thank you always for your help.

When I start MONAILabel server I see something like this:

root@perklabseg:/opt/monai# monailabel start_server --app /opt/monai/MONAILabel/apps/radiology --studies /opt/monai/MONAILabel/datasets/Task09_Spleen/imagesTr --conf models deepedit --port 9005 --host 127.0.0.1
Using PYTHONPATH=/opt:
[2022-06-24 12:29:09,732] [387] [MainThread] [INFO] (__main__:292) - USING:: app = /opt/monai/MONAILabel/apps/radiology
[2022-06-24 12:29:09,732] [387] [MainThread] [INFO] (__main__:292) - USING:: studies = /opt/monai/MONAILabel/datasets/Task09_Spleen/imagesTr
[2022-06-24 12:29:09,732] [387] [MainThread] [INFO] (__main__:292) - USING:: verbose = INFO
[2022-06-24 12:29:09,732] [387] [MainThread] [INFO] (__main__:292) - USING:: conf = [['models', 'deepedit']]
[2022-06-24 12:29:09,732] [387] [MainThread] [INFO] (__main__:292) - USING:: host = 127.0.0.1
[2022-06-24 12:29:09,732] [387] [MainThread] [INFO] (__main__:292) - USING:: port = 9005
[2022-06-24 12:29:09,732] [387] [MainThread] [INFO] (__main__:292) - USING:: uvicorn_app = monailabel.app:app
...
[2022-06-24 12:29:10,649] [387] [MainThread] [INFO] (uvicorn.error:59) - Application startup complete.
[2022-06-24 12:29:10,649] [387] [MainThread] [INFO] (uvicorn.error:206) - Uvicorn running on http://127.0.0.1:9005 (Press CTRL+C to quit)

After this, if I open the server URL in a web browser, I see this:

Do you see something similar on your computer?

1 Like

Thank you, Lassoan, for your response!
Sadly, I do not see any message on my python interactor after loading the MONAILabel module.

Confirming the server URL for the TOMAAT also gives an error message as below, and I wonder if this is due to the same reason.

USING HOST IN DIRECT CONNECTION PANE
Execute GET by global HTTPS CERT system
Starting new HTTPS connection (1): localhost
Execute GET UNSAFE
Starting new HTTPS connection (1): localhost
Host is not reachable! (https://localhost:9000/interface)

Installing MONAILabel module is not sufficient. You also need to configure and start a MONAILabel server (outside Slicer).

Thank you Lassoan for your reply!
After your feedback, I went to GitHub link and tried to install the monailabel on my computer using window cmd.
I was able to install the monailabel-weekly outside the slicer. However, an error message pops up when I try to move to the next step.
Following is the script I tried to run and the error message I get.
Sorry for bothering you again, but could you please give me some advice?
Thank you always for your help.

monailabel --help
monailabel apps --download --name radiology --output apps
monailabel datasets --download --name Task09_Spleen --output datasets

#returned error message
‘monailabel’ is not recognized as an internal or external command, operable program or batch file

You

This means monailabel has not been installed (or at least not correctly installed and executable is not on the path).

Did you follow the instructions to install MonaiLabel? Which method did you use?

Hello, @muratmaga!

Thank you for your reply.

Yes, I have followed the instruction you linked.

Here are my steps:

  1. opened Window cmd
  2. Install the following Python libraries
  3. used command “pip install monailabel-weekly”
  4. checked if the installed package “pip list”
    • monai and monailabel-weekly(0.4.dev2226) were on the list

I uninstalled the package and tried it again on the Anaconda Powershell Powershell Prompt (Anaconda3) but it gives me following message.

(base) PS C:\Windows\system32> monailabel --help

Using PYTHONPATH=C:\ProgramData;

OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.

OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.

Here is the validation of the monai installation.

I don’t have experience running MonaiLabel through the python environment, I only used it through docker which simplified things quite a bit.

Perhaps you can take a look at @rbumm explanations here:

1 Like

Hi,

Maybe this Google doc helps.
Was not use Anaconda at all during recent installation processes.

2 Likes

@rbumm would you mind uploading these instructions to your project page? Google docs are not indexed by web search services, cannot be found by searching in the ProjectWeeks repository, etc.

Thank you guys for all the help!!

@rbumm, I was able to make the monailabel work with the Google doc you provided! I can’t even express how grateful I am for your help!
I think the problem was that I was at my system32 directory, not the user directory.

Also, I tried running the monailabel with docker, which was much more straightforward, just like @muratmaga have mentioned! Thank you!

2 Likes

Absolutely, @lassoan
The information is now here and linked from the MONAI Label lung project page. The Google doc received a ‘move page’ notice.

2 Likes

Perfect, thank you very much!

1 Like

Many thanks for the support, @rbumm @lassoan @muratmaga :slight_smile:

@muratmaga could you maybe add a few points about how you installed MONAI Label through docker exactly? Thank you.
ping @diazandr3s

1 Like

This is a good point.

I’ve mostly used Docker on Linux, but it should also work on Windows.

The first step is to make sure nvidia docker is installed on the computer. Then, by running this command you should be able to start the docker container with MONAI Label installed:

docker run --gpus all --rm -ti --ipc=host --net=host projectmonai/monailabel:latest bash

Here I show the ways of installing MONAI Label: MONAI Label Installation - PyPi, Docker, and GitHub - YouTube

2 Likes

Happy to, but can I edit that link?

1 Like

@lassoan could you maybe enable @muratmaga for editing the 37th Project Week MONAIL Label installation GitHub document? Thank you
@muratmaga feel free to add your name at the top :slight_smile:

Everyone can edit the Project Week pages. If you don’t have direct write access then GitHub will offer you to create a pull request for you - just accept that.

1 Like