# Can't access MONAI Label server from 3D Slicer

**URL:** <https://discourse.slicer.org/t/cant-access-monai-label-server-from-3d-slicer/31301>\
**Category:** Support\
**Tags:** python, monailabel\
**Created:** [August 22, 2023, 10:23pm UTC](https://discourse.slicer.org/t/cant-access-monai-label-server-from-3d-slicer/31301 "2023-08-22T22:23:22Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![shihje](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shihje/32/67267_2.png) [@shihje](https://discourse.slicer.org/u/shihje)\
**Post date:** [August 22, 2023, 10:23pm UTC](https://discourse.slicer.org/t/cant-access-monai-label-server-from-3d-slicer/31301/1 "2023-08-22T22:23:23Z")

</div>

I’m trying to use 3D Slicer as a visualization tool for MONAI Label. I started up the MONAI Label server using the monailabel CLI in an SSH terminal, and got an IP address of the Uvicorn session:

 ![monai label server](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/4/048ec44e0b7e2ba240dbeadf86a0eb4c3219f572.png)

I then input this IP address in the MONAI Label extension of 3D Slicer:  
 ![3d monai](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/e/be584df588eb48750c18c15dd0921436cbfb3f17.png)

I am unable to connect and receive the following error:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/6/86e002fd95f557b024725e9fbc30c5a56f7a3b2b.png)

The details are below. Is this an access issue from my end, or with MONAI Label’s servers, or something else?

> Traceback (most recent call last):  
> File “C:/Users/uXXXXXXX/AppData/Local/NA-MIC/Slicer 5.2.2/NA-MIC/Extensions-31382/MONAILabel/lib/Slicer-5.2/qt-scripted-modules/MONAILabel.py”, line 1072, in fetchInfo  
> info = self.logic.info()  
> File “C:/Users/uXXXXXXX/AppData/Local/NA-MIC/Slicer 5.2.2/NA-MIC/Extensions-31382/MONAILabel/lib/Slicer-5.2/qt-scripted-modules/MONAILabel.py”, line 2263, in info  
> return self.\_client().info()  
> File “C:/Users/uXXXXXXX/AppData/Local/NA-MIC/Slicer 5.2.2/NA-MIC/Extensions-31382/MONAILabel/lib/Slicer-5.2/qt-scripted-modules/MONAILabel.py”, line 2239, in \_client  
> if mc.auth\_enabled():  
> File “C:\Users\uXXXXXXX\AppData\Local\NA-MIC\Slicer 5.2.2\NA-MIC\Extensions-31382\MONAILabel\lib\Slicer-5.2\qt-scripted-modules\MONAILabelLib\client.py”, line 83, in auth\_enabled  
> status, response, \_, \_ = MONAILabelUtils.http\_method(“GET”, self.\_server\_url, selector)  
> File “C:\Users\uXXXXXXX\AppData\Local\NA-MIC\Slicer 5.2.2\NA-MIC\Extensions-31382\MONAILabel\lib\Slicer-5.2\qt-scripted-modules\MONAILabelLib\client.py”, line 521, in http\_method  
> conn.request(method, selector, body=body, headers=headers)  
> File “C:\Users\uXXXXXXX\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Lib\http\client.py”, line 1285, in request  
> self.\_send\_request(method, url, body, headers, encode\_chunked)  
> File “C:\Users\uXXXXXXX\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Lib\http\client.py”, line 1331, in \_send\_request  
> self.endheaders(body, encode\_chunked=encode\_chunked)  
> File “C:\Users\uXXXXXXX\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Lib\http\client.py”, line 1280, in endheaders  
> self.\_send\_output(message\_body, encode\_chunked=encode\_chunked)  
> File “C:\Users\uXXXXXXX\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Lib\http\client.py”, line 1040, in \_send\_output  
> self.send(msg)  
> File “C:\Users\uXXXXXXX\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Lib\http\client.py”, line 980, in send  
> self.connect()  
> File “C:\Users\uXXXXXXX\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Lib\http\client.py”, line 946, in connect  
> self.sock = self.\_create\_connection(  
> File “C:\Users\uXXXXXXX\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Lib\socket.py”, line 844, in create\_connection  
> raise err  
> File “C:\Users\uXXXXXXX\AppData\Local\NA-MIC\Slicer 5.2.2\lib\Python\Lib\socket.py”, line 832, in create\_connection  
> sock.connect(sa)  
> OSError: [WinError 10049] The requested address is not valid in its context

---

<div class="post-metadata">

**Author:** ![mangotee](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@mangotee](https://discourse.slicer.org/u/mangotee)\
**Post date:** [August 23, 2023, 8:48am UTC](https://discourse.slicer.org/t/cant-access-monai-label-server-from-3d-slicer/31301/2 "2023-08-23T08:48:26Z")

</div>

Hi,  
sounds like you are almost there. The URL displayed in the CLI output needs to be modified. In `http://0.0.0.0:8000`, replace the `0.0.0.0` part with the IP address of your server where MONAI Label is running on. For example:

- If you are running this on localhost (i.e. MONAI Label server and 3D Slicer are running locally on the same laptop/workstation), then replace it with `http://127.0.0.1:8000`
- If you are running MONAI Label on a remote server and 3D Slicer locally, then enter that address, e.g. `http://123.456.789.012:8000`

If this does not help, it would be great if you could share the server setup - is this the same workstation, or is MONAI Label server running remotely? Did you start MONAI Label server from inside a docker container or barebone with a local conda/pip install?

---

<div class="post-metadata">

**Author:** ![shihje](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shihje/32/67267_2.png) [@shihje](https://discourse.slicer.org/u/shihje)\
**Post date:** [September 1, 2023, 5:30pm UTC](https://discourse.slicer.org/t/cant-access-monai-label-server-from-3d-slicer/31301/3 "2023-09-01T17:30:04Z")

</div>

Hi, I’ve tried the local server as well, and it does not help. I’m starting the server from a local pip install, attempting to run it from the same workstation. If it helps, I’m able to run a Jupyter Server to run jupyter notebooks, for instance. It runs on the local host and uses a token. Does the MONAI Label server have a similar protocol? Similarly, how do I try and run MONAI Label on a remote server? Do I have to set anything up, or is it as simple as entering a server address?

---

<div class="post-metadata">

**Author:** ![shihje](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shihje/32/67267_2.png) [@shihje](https://discourse.slicer.org/u/shihje)\
**Post date:** [September 1, 2023, 5:39pm UTC](https://discourse.slicer.org/t/cant-access-monai-label-server-from-3d-slicer/31301/4 "2023-09-01T17:39:30Z")

</div>

Actually - your comment gave me a clue. I tried the same port as jupyter notebook uses and it now works!

---

<div class="post-metadata">

**Author:** ![nasibov\_98](https://avatars.discourse-cdn.com/v4/letter/n/d26b3c/32.png) [@nasibov\_98](https://discourse.slicer.org/u/nasibov_98)\
**Post date:** [October 5, 2023, 8:58pm UTC](https://discourse.slicer.org/t/cant-access-monai-label-server-from-3d-slicer/31301/5 "2023-10-05T20:58:26Z")

</div>

Hi guys, I am having a very similar issue.

1. On institute HPC (linux), Built Nvidia Monai-Toolkit docker using Singularity (our institute does not allow use of docker).
2. Activated server on HPC
3. Tunneled into HPC Monai-toolkit server from local computer
4. Accessed Jupyter-lab that comes with Monai-toolkit container
5. Accessed terminal within Jupyter-lab
6. Installed radiology app and sample task Spleen09
7. Started Monai Label server - no problems so far
8. Installed 3D slicer on local computer and accessed MonaiLabel Module
9. I input the same server address that the Monai-Toolkit server gave me for accessing jupyter lab but I get the infamous error:  
 ![Screenshot 2023-10-05 at 21.56.38](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/3/c33ae137f2fe9257d78310471eb5989ab3f8f31d.png)

I also tried putting in the IP that the jupyter server outputted, followed by :8888 but that isnt working either

Can you make any suggestions?

---

<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:** [October 6, 2023, 9:36pm UTC](https://discourse.slicer.org/t/cant-access-monai-label-server-from-3d-slicer/31301/6 "2023-10-06T21:36:26Z")

</div>

> [@nasibov\_98](#):
>
> Installed 3D slicer on local computer and accessed MonaiLabel Module

Did you create the tunnel to the HPC server from the computer you installed the Slicer (In the last step)?

---

<div class="post-metadata">

**Author:** ![nasibov\_98](https://avatars.discourse-cdn.com/v4/letter/n/d26b3c/32.png) [@nasibov\_98](https://discourse.slicer.org/u/nasibov_98)\
**Post date:** [October 7, 2023, 2:57pm UTC](https://discourse.slicer.org/t/cant-access-monai-label-server-from-3d-slicer/31301/7 "2023-10-07T14:57:08Z")

</div>

yes, I have tunneled in and connected successfully to the node running my server on the HPC.

---

<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:** [October 8, 2023, 11:02pm UTC](https://discourse.slicer.org/t/cant-access-monai-label-server-from-3d-slicer/31301/8 "2023-10-08T23:02:57Z")

</div>

The way we implement MonaoLabel into Slicer is way too complicated. It is a science on its own and requires programming experience.  
It should be built into the program with its own automatic server and become an integral part of the segment editor. Same a Slicer LLM should assist in solving problems before people get lost.  
Slicer should have several detail layers (noob, beginner, expert) to facilitate clinical or scientific use.  
I suggest a roadmap for 2030 with a clear goal and strategy.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [October 10, 2023, 9:17pm UTC](https://discourse.slicer.org/t/cant-access-monai-label-server-from-3d-slicer/31301/9 "2023-10-10T21:17:40Z")

</div>

Agreed @rbumm, the current implementation of MONAI Label is hard for people to install and modify. It would be great if we could figure out a way to improve that, perhaps with a funded effort via an NIH grant or similar. As you know most of the core developers implement things they need for their own projects so general usability improvements are often hard to allocate resources for.

---

<div class="post-metadata">

**Author:** ![nasibov\_98](https://avatars.discourse-cdn.com/v4/letter/n/d26b3c/32.png) [@nasibov\_98](https://discourse.slicer.org/u/nasibov_98)\
**Post date:** [October 15, 2023, 4:21pm UTC](https://discourse.slicer.org/t/cant-access-monai-label-server-from-3d-slicer/31301/10 "2023-10-15T16:21:53Z")

</div>

Dr. Andres emailed me suggesting port mapping may be the issue and thats exactly what it was (8000 is the default port), but thanks for the help everyone. I agree with the points made by @rbumm and @pieper, I think the Monai label documentation needs a revamp, and it needs to be put in the context of the biomedical/clinical user’s experience rather than a bioinformatician’s.

Cheers,

Ulvi

---

<div class="post-metadata">

**Author:** ![lhssu](https://avatars.discourse-cdn.com/v4/letter/l/d6d6ee/32.png) [@lhssu](https://discourse.slicer.org/u/lhssu)\
**Post date:** [October 16, 2023, 6:59am UTC](https://discourse.slicer.org/t/cant-access-monai-label-server-from-3d-slicer/31301/11 "2023-10-16T06:59:11Z")

</div>

@mangotee Hi, i running the MONAI LABEL server which inside a docker container from a server and i got the same access issue, do you know how to set correct server ip in 3dslicer in this case?  
For example,  
my server ip is 10.10.10.15  
the docker port is 5735:8888  
monailabel shows"http:0.0.0.0:8000"  
what the correct ip should be? i tried 10.10.10.15:5735, and 10.10.10.15:8000, it shows connect refused

---

<div class="post-metadata">

**Author:** ![natachavalador](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/natachavalador/32/79247_2.png) [@natachavalador](https://discourse.slicer.org/u/natachavalador)\
**Post date:** [January 27, 2025, 6:10pm UTC](https://discourse.slicer.org/t/cant-access-monai-label-server-from-3d-slicer/31301/12 "2025-01-27T18:10:35Z")

</div>

Hi,  
It seems I am facing the same problem with the server.

. Running on my own pc (Windows 11)  
. 3D Slicer installed with MonaiLabel plug-in working  
. Tryed Anaconda, Python 3.11 and Visual Studio Code as an interface  
. Followed precisely all tutorials from Andres Pinto and the server remains not working  
. Tried to mix my personal IP with the Port :8000 and the error remains

Could you help me?

KR,  
Natacha Valador
