Open zs856 opened 2 weeks ago
@zs856 From your exceptions, your're actually connecting to milvus using this: uni[x:/tmp/tmph2hmv5a4_milvus_demo.db.sock](file:///X:/tmp/tmph2hmv5a4_milvus_demo.db.sock)
and it failed.
Seems like something's wrong when connecting to Milvus lite. @junjiejiangjjj Please help identify if this's a bug of Milvus-lite
/assign @junjiejiangjjj
@XuanYang-cn: GitHub didn't allow me to assign the following users: junjiejiangjjj.
Note that only milvus-io members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. For more information please see the contributor guide
Right now milvus-lite doesn't support native Windows install yet, but can work around with wsl (https://learn.microsoft.com/en-us/windows/wsl/install),
I am currently developing in WSL, Ubuntu 24 + VSCode + Jupyter Lab (with port forwarding)
Try running this code directly on wsl
from pymilvus import MilvusClient
milvus_client = MilvusClient('./milvus_demo.db')
from pymilvus import MilvusClient milvus_client = MilvusClient('./milvus_demo.db')
2024-07-02 22:35:22,904 - pymilvus.milvus_client.milvus_client - ERROR - Failed to create new connection using: 0632f8c0045d4cd6b811b2dd0ab219f3
---------------------------------------------------------------------------
MilvusException Traceback (most recent call last)
[... skipping hidden 1 frame]
Cell In[97], line 2
1 from pymilvus import MilvusClient
----> 2 milvus_client = MilvusClient('./milvus_demo.db')
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/milvus_client/milvus_client.py:58, in MilvusClient.__init__(self, uri, user, password, db_name, token, timeout, **kwargs)
46 """A client for the common Milvus use case.
47
48 This client attempts to hide away the complexity of using Pymilvus. In a lot ofcases what
(...)
56 to None.
57 """
---> 58 self._using = self._create_connection(
59 uri, user, password, db_name, token, timeout=timeout, **kwargs
60 )
61 self.is_self_hosted = bool(utility.get_server_type(using=self._using) == "milvus")
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/milvus_client/milvus_client.py:651, in MilvusClient._create_connection(self, uri, user, password, db_name, token, **kwargs)
650 logger.error("Failed to create new connection using: %s", using)
--> 651 raise ex from ex
652 else:
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/milvus_client/milvus_client.py:648, in MilvusClient._create_connection(self, uri, user, password, db_name, token, **kwargs)
647 try:
--> 648 connections.connect(using, user, password, db_name, token, uri=uri, **kwargs)
649 except Exception as ex:
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/orm/connections.py:447, in Connections.connect(self, alias, user, password, db_name, token, **kwargs)
445 kwargs["secure"] = True
--> 447 connect_milvus(**kwargs, user=user, password=password, token=token, db_name=db_name)
448 return
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/orm/connections.py:398, in Connections.connect.<locals>.connect_milvus(**kwargs)
396 timeout = t if isinstance(t, (int, float)) else Config.MILVUS_CONN_TIMEOUT
--> 398 gh._wait_for_channel_ready(timeout=timeout)
399 if kwargs.get("keep_alive", False):
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/client/grpc_handler.py:150, in GrpcHandler._wait_for_channel_ready(self, timeout)
149 except grpc.FutureTimeoutError as e:
--> 150 raise MilvusException(
151 code=Status.CONNECT_FAILED,
152 message=f"Fail connecting to server on {self._address}, illegal connection params or server unavailable",
153 ) from e
154 except Exception as e:
MilvusException: <MilvusException: (code=2, message=Fail connecting to server on uni[x:/tmp/tmp54q1oh9l_milvus_demo.db.sock](file:///X:/tmp/tmp54q1oh9l_milvus_demo.db.sock), illegal connection params or server unavailable)>
The above exception was the direct cause of the following exception:
MilvusException Traceback (most recent call last)
[... skipping hidden 1 frame]
Cell In[97], line 2
1 from pymilvus import MilvusClient
----> 2 milvus_client = MilvusClient('./milvus_demo.db')
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/milvus_client/milvus_client.py:58, in MilvusClient.__init__(self, uri, user, password, db_name, token, timeout, **kwargs)
46 """A client for the common Milvus use case.
47
48 This client attempts to hide away the complexity of using Pymilvus. In a lot ofcases what
(...)
56 to None.
57 """
---> 58 self._using = self._create_connection(
59 uri, user, password, db_name, token, timeout=timeout, **kwargs
60 )
61 self.is_self_hosted = bool(utility.get_server_type(using=self._using) == "milvus")
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/milvus_client/milvus_client.py:651, in MilvusClient._create_connection(self, uri, user, password, db_name, token, **kwargs)
650 logger.error("Failed to create new connection using: %s", using)
--> 651 raise ex from ex
652 else:
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/milvus_client/milvus_client.py:648, in MilvusClient._create_connection(self, uri, user, password, db_name, token, **kwargs)
647 try:
--> 648 connections.connect(using, user, password, db_name, token, uri=uri, **kwargs)
649 except Exception as ex:
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/orm/connections.py:447, in Connections.connect(self, alias, user, password, db_name, token, **kwargs)
445 kwargs["secure"] = True
--> 447 connect_milvus(**kwargs, user=user, password=password, token=token, db_name=db_name)
448 return
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/orm/connections.py:398, in Connections.connect.<locals>.connect_milvus(**kwargs)
396 timeout = t if isinstance(t, (int, float)) else Config.MILVUS_CONN_TIMEOUT
--> 398 gh._wait_for_channel_ready(timeout=timeout)
399 if kwargs.get("keep_alive", False):
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/client/grpc_handler.py:150, in GrpcHandler._wait_for_channel_ready(self, timeout)
149 except grpc.FutureTimeoutError as e:
--> 150 raise MilvusException(
151 code=Status.CONNECT_FAILED,
152 message=f"Fail connecting to server on {self._address}, illegal connection params or server unavailable",
153 ) from e
154 except Exception as e:
MilvusException: <MilvusException: (code=2, message=Fail connecting to server on uni[x:/tmp/tmp54q1oh9l_milvus_demo.db.sock](file:///X:/tmp/tmp54q1oh9l_milvus_demo.db.sock), illegal connection params or server unavailable)>
The above exception was the direct cause of the following exception:
MilvusException Traceback (most recent call last)
Cell In[97], line 2
1 from pymilvus import MilvusClient
----> 2 milvus_client = MilvusClient('./milvus_demo.db')
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/milvus_client/milvus_client.py:58, in MilvusClient.__init__(self, uri, user, password, db_name, token, timeout, **kwargs)
36 def __init__(
37 self,
38 uri: str = "http://localhost:19530",
(...)
44 **kwargs,
45 ) -> None:
46 """A client for the common Milvus use case.
47
48 This client attempts to hide away the complexity of using Pymilvus. In a lot ofcases what
(...)
56 to None.
57 """
---> 58 self._using = self._create_connection(
59 uri, user, password, db_name, token, timeout=timeout, **kwargs
60 )
61 self.is_self_hosted = bool(utility.get_server_type(using=self._using) == "milvus")
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/milvus_client/milvus_client.py:651, in MilvusClient._create_connection(self, uri, user, password, db_name, token, **kwargs)
649 except Exception as ex:
650 logger.error("Failed to create new connection using: %s", using)
--> 651 raise ex from ex
652 else:
653 logger.debug("Created new connection using: %s", using)
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/milvus_client/milvus_client.py:648, in MilvusClient._create_connection(self, uri, user, password, db_name, token, **kwargs)
646 using = uuid4().hex
647 try:
--> 648 connections.connect(using, user, password, db_name, token, uri=uri, **kwargs)
649 except Exception as ex:
650 logger.error("Failed to create new connection using: %s", using)
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/orm/connections.py:447, in Connections.connect(self, alias, user, password, db_name, token, **kwargs)
444 if parsed_uri.scheme == "https":
445 kwargs["secure"] = True
--> 447 connect_milvus(**kwargs, user=user, password=password, token=token, db_name=db_name)
448 return
450 # 2nd Priority, connection configs from env
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/orm/connections.py:398, in Connections.connect.<locals>.connect_milvus(**kwargs)
395 t = kwargs.get("timeout")
396 timeout = t if isinstance(t, (int, float)) else Config.MILVUS_CONN_TIMEOUT
--> 398 gh._wait_for_channel_ready(timeout=timeout)
399 if kwargs.get("keep_alive", False):
400 gh.register_state_change_callback(
401 ReconnectHandler(self, alias, kwargs_copy).reconnect_on_idle
402 )
File /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/pymilvus/client/grpc_handler.py:150, in GrpcHandler._wait_for_channel_ready(self, timeout)
148 self._setup_identifier_interceptor(self._user, timeout=timeout)
149 except grpc.FutureTimeoutError as e:
--> 150 raise MilvusException(
151 code=Status.CONNECT_FAILED,
152 message=f"Fail connecting to server on {self._address}, illegal connection params or server unavailable",
153 ) from e
154 except Exception as e:
155 raise e from e
MilvusException: <MilvusException: (code=2, message=Fail connecting to server on unix:/tmp/tmp54q1oh9l_milvus_demo.db.sock, illegal connection params or server unavailable)>
I got this
Run this command in the wsl terminal so that the error log is clearer。Please make sure milvus_lite is installed in this directory:/mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/
LD_LIBRARY_PATH=/mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/milvus_lite/lib/ /mnt/d/development/Github/streamlit-hello/.venv/lib/python3.12/site-packages/milvus_lite/lib/milvus ./mivlus.db unix:/tmp/tmp54q1oh9l_milvus_demo.db.sock INFO
Is there an existing issue for this?
Describe the bug
I tried to use the locally configured milvus for development work, and then it gave this exception.During the development process, I tried to switch the WIFI network. I don't know if it has anything to do with this:
Expected Behavior
Local Milvus files can be used normally
Steps/Code To Reproduce behavior
logging.info(f"RecursiveCharacterTextSplitter: {CHUNK_SIZE=},{CHUNK_OVERLAP=}") text_splitter = RecursiveCharacterTextSplitter.from_tiktoken_encoder( chunk_size=CHUNK_SIZE, chunk_overlap=CHUNK_OVERLAP ) doc_splits = text_splitter.split_documents(docs)
Add to Milvus
vectorstore =Milvus.from_documents( documents=doc_splits, collection_name=COLLECTION_NAME, embedding=HuggingFaceEmbeddings(model_name=MODEL_NAME,multi_process=False, show_progress=True, model_kwargs={"local_files_only":True}), connection_args=connection_args, )
Environment details
Anything else?
No response