【已解决】python init_database.py --recreate-vs运行报错

Langchain初始化数据库报错
在这里插入图片描述
创建pwd.py文件,内容如下

from os import * 
from pwd import * 

def get_username():
    return getpwuid(getuid())[0]

然后将文件拷贝到lib下
在这里插入图片描述
这里每个人可能都不同,我是拷贝到这里解决的,原社区的方法没有解决我的问题,如果这个方法不行,可以参考社区
社区:https://github.com/chatchat-space/Langchain-Chatchat/issues/3003

感谢观看,如果有用请点赞评论支持一下。

init_database.py --recreate-vs 2025-07-29 16:51:24,763 - utils.py[line:148] - INFO: Note: NumExpr detected 24 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 8. 2025-07-29 16:51:24,763 - utils.py[line:160] - INFO: NumExpr defaulting to 8 threads. recreating all vector stores 2025-07-29 16:51:25,437 - faiss_cache.py[line:92] - INFO: loading vector store in 'samples/vector_store/bge-large-zh-v1.5' from disk. 2025-07-29 16:51:25,594 - embeddings_api.py[line:39] - ERROR: Could not import sentence_transformers python package. Please install it with `pip install sentence_transformers`. AttributeError: 'NoneType' object has no attribute 'conjugate' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "D:\nudt\Langchain-Chatchat\init_database.py", line 107, in <module> folder2db(kb_names=args.kb_name, mode="recreate_vs", embed_model=args.embed_model) File "D:\nudt\Langchain-Chatchat\server\knowledge_base\migrate.py", line 121, in folder2db kb.create_kb() File "D:\nudt\Langchain-Chatchat\server\knowledge_base\kb_service\base.py", line 82, in create_kb self.do_create_kb() File "D:\nudt\Langchain-Chatchat\server\knowledge_base\kb_service\faiss_kb_service.py", line 51, in do_create_kb self.load_vector_store() File "D:\nudt\Langchain-Chatchat\server\knowledge_base\kb_service\faiss_kb_service.py", line 28, in load_vector_store return kb_faiss_pool.load_vector_store(kb_name=self.kb_name, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\nudt\Langchain-Chatchat\server\knowledge_base\kb_cache\faiss_cache.py", line 102, in load_vector_store vector_store = self.new_vector_store(embed_model=embed_model, embed_device=embed_device) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\nudt\Langchain-Chatchat\server\knowledge_base\kb_cache\faiss_cache.py", line 60, in new_vector_store vector_store =
最新发布
07-30
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值