安装dify的几个问题

下载启动dify

git clone git@gitee.com:dify_ai/dify.git

复制代码
cd dify/docker
cp .env.example  .env

docker compose up -d

此时可能 报错

failed to launch plugin: failed to install dependencies: failed to install dependencies: signal: killed, output: DEBUG uv 0.9.26 DEBUG Acquired shared lock for `/root/.cache/uv` DEBUG Found project root: `/app/storage/cwd/langgenius/ollama-0.1.3@66e156c4f612964c131c49168882e78c2cdfe366879506b97ad855b23c5d6d98` DEBUG No workspace root found, using project root DEBUG Acquired exclusive lock for `/app/storage/cwd/langgenius/ollama-0.1.3@66e156c4f612964c131c49168882e78c2cdfe366879506b97ad855b23c5d6d98` DEBUG No...r: https://files.pythonhosted.org/packages/11/79/479e2194c9096b92aecdf33634ae948d2be306c6011673e98ee1917f32c2/dpkt-1.9.8-py3-none-any.whl DEBUG Sending fresh GET request for: https://files.pythonhosted.org/packages/11/79/479e2194c9096b92aecdf33634ae948d2be306c6011673e98ee1917f32c2/dpkt-1.9.8-py3-none-any.whl Downloading pydantic-core (2.0MiB) Downloading numpy (15.3MiB) Downloading tiktoken (1.1MiB) Downloading gevent (2.0MiB) init process exited due to no activity for 120 seconds failed to init environment

解决方法

复制代码
cd dify/docker
vi .env


修改
# 1. (关键) 更换 PIP 镜像源为国内源,这是解决下载慢最有效的办法
PIP_MIRROR_URL=https://pypi.tuna.tsinghua.edu.cn/simple

# 2. 大幅增加插件环境初始化超时时间(单位:秒),从默认的120增加到360或更高
PLUGIN_PYTHON_ENV_INIT_TIMEOUT=360

# 3. (可选) 如果担心其他步骤也超时,可以一并增加插件最大执行超时时间
PLUGIN_MAX_EXECUTION_TIMEOUT=1800

安装ollama

curl -fsSL https://ollama.com/install.sh | sh

如果在ubuntu 上 可以

sudo snap install ollama

ollama 常用命令

ollama run qwen:7b

ollama list

ollama rm <模型名>

snap 修改ollama 环境变量

snap set ollama host="0.0.0.0:11434" 后,请运行 snap get ollama

在 Dify 中连接 Ollama

配置生效后,在 Dify 的 Ollama 插件设置中:

配置项
Base URL http://host.docker.internal:11434
模型名称 deepseek-r1:1.5b
相关推荐
花酒锄作田16 小时前
Pydantic校验配置文件
python
hboot16 小时前
AI工程师第四课 - 深度学习入门
pytorch·python·神经网络
ZhengEnCi1 天前
P2M-Matplotlib折线图完全指南-从数据可视化到趋势分析的Python绘图利器
python·matlab·数据可视化
ZhengEnCi1 天前
P2L-Matplotlib饼图完全指南-从数据可视化到图表定制的Python绘图利器
python·matlab
曲幽1 天前
你的REST接口还在“过度投喂”数据吗?——FastAPI + GraphQL实战避坑指南
python·fastapi·web·graphql·route·cors·rest·strawberry
用户8358086187911 天前
基于 Self-RAG 与列表级重排序的进阶 RAG 系统设计与实现
python
Warson_L2 天前
Python `Annotated` 与 LangGraph Reducer 学习笔记
python
韩师傅2 天前
海天线算法的前世今生
python·计算机视觉
韩师傅2 天前
当你的甲方设备过烂,要如何快速出效果?
python·计算机视觉
Warson_L2 天前
LangGraph的MessageState and HumanMessage
python