Runtime error: MilvusException: (code=2, message=Fail connecting to server on Timeout

I am trying to host a gradio app. → refer here

Please note the app requires also a docker compose.yml etc… which are all uploaded within the files on huggingface space.

I get the following error.
The app runs well locally on my computer. I am not sure how to debug this error. Please help.

Runtime error
Traceback (most recent call last):
File “/home/user/.local/lib/python3.10/site-packages/pymilvus/client/”, line 114, in _wait_for_channel_ready
File “/home/user/.local/lib/python3.10/site-packages/grpc/”, line 151, in result
File “/home/user/.local/lib/python3.10/site-packages/grpc/”, line 97, in _block
raise grpc.FutureTimeoutError()

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/home/user/app/”, line 40, in
collection = create_milvus_collection(‘text_image_search’, 512)
File “/home/user/app/”, line 19, in create_milvus_collection
connections.connect(host=‘’, port=‘19530’)
File “/home/user/.local/lib/python3.10/site-packages/pymilvus/orm/”, line 303, in connect
connect_milvus(**kwargs, user=user, password=password)
File “/home/user/.local/lib/python3.10/site-packages/pymilvus/orm/”, line 274, in connect_milvus
File “/home/user/.local/lib/python3.10/site-packages/pymilvus/client/”, line 117, in _wait_for_channel_ready
raise MilvusException(Status.CONNECT_FAILED,
pymilvus.exceptions.MilvusException: <MilvusException: (code=2, message=Fail connecting to server on Timeout)>

@radames Please let me know where I have to run docker compose if this error is related to docker

hi @chandrakalagowda,

We currently don’t support docker compose on Spaces, so if you’re planning to run your Space app with another extra service you’ll need an extra step with a bash script to run your multiple services on the same container.

Please read more about Spaces Docker here

I also notice on your the sdk set to gradio not Dockerfile, so I’m not sure if you’re trying to run a Gradio app

For a multi-service Dockerfile example here is a complete Space

Hello @radames,

Thank you so much for the pointers. My code,
uses gradio for deploying the app. The code also uses milvus vector database to do a “text to image” search. Locally on my computer, this was achieved using a standalone installation using docker-compose.yml. (see here Any pointers to how to enable my code to access milvus vector database without docker-compose.yml on huggingspace will be helpful. Do you have examples where a gradio app uses milvus vector database in the code. I will look for the same meanwhile.

Thank you for your time.

hi @chandrakalagowda ,

Yes I understand now, maybe you can try the Lite version for now?

1 Like

Yes. Thats good for a start.

Thank you

1 Like

I just want to check to see if using Milvus Lite works for you?