langchain-chatchat知识库初始化失败的坑
项目场景:
提示:这里简述项目相关背景:
langchai-chatchat 0.3.1+xinference
问题描述
提示:这里描述项目中遇到的问题:
本地部署完毕,chatchat init初始化完成,在进行chatchat kb -r时候,系统提示错误如下:
chatchat.server.knowledge_base.utils:files2docs_in_thread_file2docs:419 - LookupError: 从文件 samples/test_files/langchain.pdf 加载文档时出错:
Resource punkt not found.
Please use the NLTK Downloader to obtain the resource:
import nltk
nltk.download(‘punkt’)
For more information see: https://www.nltk.org/data.html
Attempted to load tokenizers/punkt/english.pickle
Searched in:
- ‘C:\Users\Administrator/nltk_data’
- ‘C:\ProgramData\anaconda3\envs\chatchat310\nltk_data’
- ‘C:\ProgramData\anaconda3\envs\chatchat310\share\nltk_data’
- ‘C:\ProgramData\anaconda3\envs\chatchat310\lib\nltk_data’
- ‘C:\Users\Administrator\AppData\Roaming\nltk_data’
- ‘C:\nltk_data’
- ‘D:\nltk_data’
- ‘E:\nltk_data’
- ‘F:\chat-demo\data\nltk_data’
- ‘’
原因分析:
提示:这里填写问题的分析:
NLTk包缺失引起。NLTK包用于人类自然语言处理包,是langchain-chathcat知识库矢量化需要用的包,但不知道为什么chatchat安装文档里没有关于这个包的详细说明,这个包的具体作用和完整安装方法可自行参考相关文档。
解决方案:
提示:这里填写该问题的具体解决方案:
因为我使用的CONDA环境部署的,env名称为chatchat310
重新把nltk_data的其他模块安装完成即可,默认安装到默认路径下,无须更改
启动PYTHON
import nltk
nltk.download()
等待下载并解包安装完成即可。如果出现错误无法下载,则检查下面地址是否可以访问:
https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/index.xml
如果无法打开,请使用代理或其他方式再试。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)