当我们在windows 使用milvus 数据库构建RAG,出现一个包一直安装不上。
from pymilvus import MilvusClient
milvus_client = MilvusClient(uri="db/milvus_db.db")
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
[... skipping hidden 1 frame]
Cell In[23], line 2
1 from pymilvus import MilvusClient
----> 2 milvus_client = MilvusClient(uri="db/milvus_db.db")
File ~\AppData\Roaming\Python\Python312\site-packages\pymilvus\milvus_client\milvus_client.py:64, in MilvusClient.__init__(self, uri, user, password, db_name, token, timeout, **kwargs)
52 """A client for the common Milvus use case.
53
54 This client attempts to hide away the complexity of using Pymilvus. In a lot ofcases what
(...) 62 to None.
63 """
---> 64 self._using = self._create_connection(
65 uri, user, password, db_name, token, timeout=timeout, **kwargs
66 )
67 self.is_self_hosted = bool(utility.get_server_type(using=self._using) == "milvus")
File ~\AppData\Roaming\Python\Python312\site-packages\pymilvus\milvus_client\milvus_client.py:917, in MilvusClient._create_connection(self, uri, user, password, db_name, token, **kwargs)
916 logger.error("Failed to create new connection using: %s", using)
--> 917 raise ex from ex
918 else:
File ~\AppData\Roaming\Python\Python312\site-packages\pymilvus\milvus_client\milvus_client.py:914, in MilvusClient._create_connection(self, uri, user, password, db_name, token, **kwargs)
913 try:
--> 914 connections.connect(using, user, password, db_name, token, uri=uri, **kwargs)
915 except Exception as ex:
File ~\AppData\Roaming\Python\Python312\site-packages\pymilvus\orm\connections.py:388, in Connections.connect(self, alias, user, password, db_name, token, _async, **kwargs)
384 raise ConnectionConfigException(
385 message=f"Open local milvus failed, dir: {parent_path} not exists"
386 )
--> 388 from milvus_lite.server_manager import (
389 server_manager_instance,
390 )
392 local_uri = server_manager_instance.start_and_get_uri(kwargs["uri"])
ModuleNotFoundError: No module named 'milvus_lite'
The above exception was the direct cause of the following exception:
ModuleNotFoundError Traceback (most recent call last)
[... skipping hidden 1 frame]
Cell In[23], line 2
1 from pymilvus import MilvusClient
----> 2 milvus_client = MilvusClient(uri="db/milvus_db.db")
File ~\AppData\Roaming\Python\Python312\site-packages\pymilvus\milvus_client\milvus_client.py:64, in MilvusClient.__init__(self, uri, user, password, db_name, token, timeout, **kwargs)
52 """A client for the common Milvus use case.
53
54 This client attempts to hide away the complexity of using Pymilvus. In a lot ofcases what
(...) 62 to None.
63 """
---> 64 self._using = self._create_connection(
65 uri, user, password, db_name, token, timeout=timeout, **kwargs
66 )
67 self.is_self_hosted = bool(utility.get_server_type(using=self._using) == "milvus")
File ~\AppData\Roaming\Python\Python312\site-packages\pymilvus\milvus_client\milvus_client.py:917, in MilvusClient._create_connection(self, uri, user, password, db_name, token, **kwargs)
916 logger.error("Failed to create new connection using: %s", using)
--> 917 raise ex from ex
918 else:
File ~\AppData\Roaming\Python\Python312\site-packages\pymilvus\milvus_client\milvus_client.py:914, in MilvusClient._create_connection(self, uri, user, password, db_name, token, **kwargs)
913 try:
--> 914 connections.connect(using, user, password, db_name, token, uri=uri, **kwargs)
915 except Exception as ex:
File ~\AppData\Roaming\Python\Python312\site-packages\pymilvus\orm\connections.py:388, in Connections.connect(self, alias, user, password, db_name, token, _async, **kwargs)
384 raise ConnectionConfigException(
385 message=f"Open local milvus failed, dir: {parent_path} not exists"
386 )
--> 388 from milvus_lite.server_manager import (
389 server_manager_instance,
390 )
392 local_uri = server_manager_instance.start_and_get_uri(kwargs["uri"])
ModuleNotFoundError: No module named 'milvus_lite'
The above exception was the direct cause of the following exception:
ModuleNotFoundError Traceback (most recent call last)
Cell In[23], line 2
1 from pymilvus import MilvusClient
----> 2 milvus_client = MilvusClient(uri="db/milvus_db.db")
File ~\AppData\Roaming\Python\Python312\site-packages\pymilvus\milvus_client\milvus_client.py:64, in MilvusClient.__init__(self, uri, user, password, db_name, token, timeout, **kwargs)
42 def __init__(
43 self,
44 uri: str = "http://localhost:19530",
(...) 50 **kwargs,
51 ) -> None:
52 """A client for the common Milvus use case.
53
54 This client attempts to hide away the complexity of using Pymilvus. In a lot ofcases what
(...) 62 to None.
63 """
---> 64 self._using = self._create_connection(
65 uri, user, password, db_name, token, timeout=timeout, **kwargs
66 )
67 self.is_self_hosted = bool(utility.get_server_type(using=self._using) == "milvus")
File ~\AppData\Roaming\Python\Python312\site-packages\pymilvus\milvus_client\milvus_client.py:917, in MilvusClient._create_connection(self, uri, user, password, db_name, token, **kwargs)
915 except Exception as ex:
916 logger.error("Failed to create new connection using: %s", using)
--> 917 raise ex from ex
918 else:
919 logger.debug("Created new connection using: %s", using)
File ~\AppData\Roaming\Python\Python312\site-packages\pymilvus\milvus_client\milvus_client.py:914, in MilvusClient._create_connection(self, uri, user, password, db_name, token, **kwargs)
912 using = uuid4().hex
913 try:
--> 914 connections.connect(using, user, password, db_name, token, uri=uri, **kwargs)
915 except Exception as ex:
916 logger.error("Failed to create new connection using: %s", using)
File ~\AppData\Roaming\Python\Python312\site-packages\pymilvus\orm\connections.py:388, in Connections.connect(self, alias, user, password, db_name, token, _async, **kwargs)
383 if not parent_path.is_dir():
384 raise ConnectionConfigException(
385 message=f"Open local milvus failed, dir: {parent_path} not exists"
386 )
--> 388 from milvus_lite.server_manager import (
389 server_manager_instance,
390 )
392 local_uri = server_manager_instance.start_and_get_uri(kwargs["uri"])
393 if local_uri is None:
ModuleNotFoundError: No module named 'milvus_lite'
在Github 有人提出了:

ModuleNotFoundError: No module named 'milvus_lite'
Milvus_lite还不支持在Windows上运行