dify 1.0.1无法在ollama下新增LLM模型
2025-3-19追加
python和pip的位置,一定要加在全局变量path的最前面,不然还是有各种可能性会失败。实测用3.10、3.11都可以。
原来在dify 0.15很正常可以添加ollama和模型,升到1.0.0之后就不行了,再后来1.0.1,以为问题都解决了,没想到还是有问题。
具体是:添加ollama是容易了,但是添加模型(比如deepseek)还是不行。表现为点“保存”后,按钮一直灰色无响应,浏览器并不锁死。看后台进程,在一段时间后(超时)出来红色的错误:
……
plugin_daemon-1 | 2025/03/17 15:13:15 runtime_lifetime.go:76: [ERROR]init environment failed: failed to install dependencies: signal: killed, output: Resolved 38 packages in 2m 15s
……
以为是dify有问题,或者以前残留的数据有原因,做了一切能做的,包括删除项目,清除存储文件,甚至docker存储的虚拟磁盘都删了,还是不行。
后来参阅一篇文章《【踩坑】pip安装依赖卡在Installing build dependencies ...》,地址:https://blog.csdn.net/m0_51371693/article/details/144268469
有所触动,升级了一下numpy和pip的版本:
PS C:\Users\Admin> pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Requirement already satisfied: numpy in c:\users\Admin\appdata\local\programs\python\python310\lib\site-packages (1.24.2) [notice] A new release of pip is available: 23.2.1 -> 25.0.1 [notice] To update, run: python.exe -m pip install --upgrade pip PS C:\Users\Admin> python.exe -m pip install --upgrade pip Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Requirement already satisfied: pip in c:\users\Admin\appdata\local\programs\python\python310\lib\site-packages (23.2.1) Collecting pip Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c9/bc/b7db44f5f39f9d0494071bddae6880eb645970366d0a200022a1a93d57f5/pip-25.0.1-py3-none-any.whl (1.8 MB) ---------------------------------------- 1.8/1.8 MB 4.0 MB/s eta 0:00:00 Installing collected packages: pip Attempting uninstall: pip Found existing installation: pip 23.2.1 Uninstalling pip-23.2.1: Successfully uninstalled pip-23.2.1 Successfully installed pip-25.0.1 PS C:\Users\Admin> pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Requirement already satisfied: numpy in c:\users\Admin\appdata\local\programs\python\python310\lib\site-packages (1.24.2) PS C:\Users\Admin>
再添加LLM模型居然立即成功了。看来是pip版本过低了?我的python版本:
PS C:\Users\Admin> py Python 3.10.10 (tags/v3.10.10:aad5f6a, Feb 7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
是装了好久的,看来是大数据变化太快了。下图是添加deepseek成功的样子:
希望给有遇到类似情况的朋友参考。