BUG:ModuleNotFoundError: No module named ‘milvus_lite‘

当我们在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 有人提出了:

[Bug]: Can't use MilvusClient() because it says "ModuleNotFoundError: No module named 'milvus_lite'" · Issue #34854 · milvus-io/milvus

ModuleNotFoundError: No module named 'milvus_lite'

Milvus_lite还不支持在Windows上运行

相关推荐
程序员清风1 小时前
程序员兼职必看:靠谱软件外包平台挑选指南与避坑清单!
java·后端·面试
李广坤2 小时前
MySQL 大表字段变更实践(改名 + 改类型 + 改长度)
数据库
皮皮林5513 小时前
利用闲置 Mac 从零部署 OpenClaw 教程 !
java
Sinclair3 小时前
简单几步,安卓手机秒变服务器,安装 CMS 程序
android·服务器
华仔啊8 小时前
挖到了 1 个 Java 小特性:var,用完就回不去了
java·后端
SimonKing8 小时前
SpringBoot整合秘笈:让Mybatis用上Calcite,实现统一SQL查询
java·后端·程序员
日月云棠1 天前
各版本JDK对比:JDK 25 特性详解
java
用户8307196840821 天前
Spring Boot 项目中日期处理的最佳实践
java·spring boot
JavaGuide1 天前
Claude Opus 4.6 真的用不起了!我换成了国产 M2.5,实测真香!!
java·spring·ai·claude code
IT探险家1 天前
Java 基本数据类型:8 种原始类型 + 数组 + 6 个新手必踩的坑
java