Runtime error: MilvusException: (code=2, message=Fail connecting to server on 127.0.0.1:19530. 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/grpc_handler.py”, line 114, in _wait_for_channel_ready
grpc.channel_ready_future(self._channel).result(timeout=timeout)
File “/home/user/.local/lib/python3.10/site-packages/grpc/_utilities.py”, line 151, in result
self._block(timeout)
File “/home/user/.local/lib/python3.10/site-packages/grpc/_utilities.py”, line 97, in _block
raise grpc.FutureTimeoutError()
grpc.FutureTimeoutError

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

Traceback (most recent call last):
File “/home/user/app/img2txt.py”, line 40, in
collection = create_milvus_collection(‘text_image_search’, 512)
File “/home/user/app/img2txt.py”, line 19, in create_milvus_collection
connections.connect(host=‘127.0.0.1’, port=‘19530’)
File “/home/user/.local/lib/python3.10/site-packages/pymilvus/orm/connections.py”, line 303, in connect
connect_milvus(**kwargs, user=user, password=password)
File “/home/user/.local/lib/python3.10/site-packages/pymilvus/orm/connections.py”, line 274, in connect_milvus
gh._wait_for_channel_ready(timeout=timeout)
File “/home/user/.local/lib/python3.10/site-packages/pymilvus/client/grpc_handler.py”, line 117, in _wait_for_channel_ready
raise MilvusException(Status.CONNECT_FAILED,
pymilvus.exceptions.MilvusException: <MilvusException: (code=2, message=Fail connecting to server on 127.0.0.1:19530. 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 README.md 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 img2txt.py,
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 https://milvus.io/docs/install_standalone-docker.md). 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?