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

**URL:** <https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021>\
**Category:** Support\
**Tags:** monailabel\
**Created:** [June 24, 2022, 10:20am UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021 "2022-06-24T10:20:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![hourglassnam](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hourglassnam/32/11796_2.png) [@hourglassnam](https://discourse.slicer.org/u/hourglassnam)\
**Post date:** [June 24, 2022, 10:20am UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/1 "2022-06-24T10:20:47Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/1/7/173435b73aa4fff6ab598708d88fb539197bf3f5.png)

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/](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.

---

<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:** [June 24, 2022, 12:35pm UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/2 "2022-06-24T12:35:22Z")

</div>

When I start MONAILabel server I see something like this:

```bash
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:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/0/506e1371792607b7cb120f167a1924ed87942940.png)

Do you see something similar on your computer?

---

<div class="post-metadata">

**Author:** ![hourglassnam](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hourglassnam/32/11796_2.png) [@hourglassnam](https://discourse.slicer.org/u/hourglassnam)\
**Post date:** [June 24, 2022, 1:24pm UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/3 "2022-06-24T13:24:41Z")

</div>

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](https://localhost:9000/interface))

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

---

<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:** [June 24, 2022, 4:44pm UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/4 "2022-06-24T16:44:10Z")

</div>

> [@hourglassnam](#):
>
> Sadly, I do not see any message on my python interactor after loading the MONAILabel module.

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

---

<div class="post-metadata">

**Author:** ![hourglassnam](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hourglassnam/32/11796_2.png) [@hourglassnam](https://discourse.slicer.org/u/hourglassnam)\
**Post date:** [June 27, 2022, 10:12am UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/5 "2022-06-27T10:12:40Z")

</div>

Thank you Lassoan for your reply!  
After your feedback, I went to [GitHub link](https://github.com/Project-MONAI/MONAILabel) 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

---

<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:** [June 27, 2022, 3:22pm UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/6 "2022-06-27T15:22:32Z")

</div>

You

> [@hourglassnam](#):
>
> ‘monailabel’ is not recognized as an internal or external command, operable program or batch file

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](https://docs.monai.io/projects/label/en/latest/installation.html)? Which method did you use?

---

<div class="post-metadata">

**Author:** ![hourglassnam](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hourglassnam/32/11796_2.png) [@hourglassnam](https://discourse.slicer.org/u/hourglassnam)\
**Post date:** [June 28, 2022, 8:37am UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/8 "2022-06-28T08:37:28Z")

</div>

Hello, [@muratmaga](https://discourse.slicer.org/u/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/](http://www.intel.com/software/products/support/).

---

<div class="post-metadata">

**Author:** ![hourglassnam](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hourglassnam/32/11796_2.png) [@hourglassnam](https://discourse.slicer.org/u/hourglassnam)\
**Post date:** [June 28, 2022, 1:18pm UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/9 "2022-06-28T13:18:04Z")

</div>

Here is the validation of the monai installation.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/0/901033cd5b8cb93019b3787379981b00a3df8104.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:** [June 28, 2022, 5:50pm UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/10 "2022-06-28T17:50:08Z")

</div>

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:](https://discourse.slicer.org/t/how-to-start-with-monailabel-for-new-models/21063/88)

---

<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 28, 2022, 8:12pm UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/11 "2022-06-28T20:12:21Z")

</div>

Hi,

Maybe this [Google doc](https://docs.google.com/document/d/1azFpJutBVJEW9W_riYZlXzrXac58ToCEzNTAwkzNf2c/edit?usp=sharing) helps.  
Was not use Anaconda at all during recent installation processes.

---

<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:** [June 29, 2022, 4:39am UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/12 "2022-06-29T04:39:47Z")

</div>

@rbumm would you mind uploading these instructions to your [project page](https://projectweek.na-mic.org/PW37_2022_Virtual/Projects/MONAILabelLung/)? Google docs are not indexed by web search services, cannot be found by searching in the ProjectWeeks repository, etc.

---

<div class="post-metadata">

**Author:** ![hourglassnam](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hourglassnam/32/11796_2.png) [@hourglassnam](https://discourse.slicer.org/u/hourglassnam)\
**Post date:** [June 29, 2022, 8:21am UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/13 "2022-06-29T08:21:46Z")

</div>

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!

---

<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 29, 2022, 9:48am UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/14 "2022-06-29T09:48:51Z")

</div>

Absolutely, @lassoan  
The information [is now here](https://projectweek.na-mic.org/PW37_2022_Virtual/Projects/MONAILabelLung/MONAILabel_Installation.html) and linked from the MONAI Label lung project page. The Google doc received a ‘move page’ notice.

---

<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:** [June 29, 2022, 2:32pm UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/15 "2022-06-29T14:32:06Z")

</div>

Perfect, thank you very much!

---

<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:** [July 4, 2022, 11:29am UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/16 "2022-07-04T11:29:07Z")

</div>

Many thanks for the support, @rbumm @lassoan @muratmaga🙂

---

<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:** [July 4, 2022, 4:27pm UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/17 "2022-07-04T16:27:29Z")

</div>

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

---

<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:** [July 4, 2022, 8:49pm UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/18 "2022-07-04T20:49:17Z")

</div>

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](https://docs.nvidia.com/ai-enterprise/deployment-guide/dg-docker.html). 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](https://www.youtube.com/watch?v=8y1OBQs2wis)

---

<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:** [July 5, 2022, 3:56pm UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/19 "2022-07-05T15:56:53Z")

</div>

> [@rbumm](#):
>
> @muratmaga could you maybe add a few points about how you installed MONAI Label through docker exactly? Thank you.

Happy to, but can I edit that link?

---

<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:** [July 5, 2022, 4:29pm UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/20 "2022-07-05T16:29:16Z")

</div>

@lassoan could you maybe enable @muratmaga for editing the [37th Project Week MONAIL Label installation GitHub](https://github.com/NA-MIC/ProjectWeek/blob/master/PW37_2022_Virtual/Projects/MONAILabelLung/MONAILabel_Installation.md) document? Thank you  
@muratmaga feel free to add your name at the top 🙂

---

<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:** [July 6, 2022, 6:32pm UTC](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021/21 "2022-07-06T18:32:57Z")

</div>

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.

[Next page](https://discourse.slicer.org/t/monailabel-cannot-connect-connectionrefusederror-winerror-10061-no-connection-could-be-made-because-the-target-machine-actively-refused-it/24021.md?page=2)
