麒麟 V10 内网环境下 Dify 插件离线安装全流程
本文记录了在 x86_64 麒麟 V10 内网环境中安装 Dify 插件的过程,从日志排查问题,到离线打包插件,确保可以在内网环境下正常运行。特别加入了 Python 版本核查与官方 vs plus 工具差异。
1. 背景环境
- 操作系统:麒麟 V10 x86_64
- Dify 部署:Docker + plugin-daemon 0.4.1
麒麟 V10 内网环境部署 Dify 插件时面临依赖缺失与 Python 版本兼容问题。通过核查系统默认 Python3.9 及手动安装 Python3.11,使用官方 dify-plugin-repackaging 工具重新打包插件以匹配 manylinux2014_x86_64 架构。解决 gevent 等依赖包无对应 ABI tag 的问题,利用 pip download 准备离线依赖并配置内部镜像源。最终实现插件在 plugin-daemon 中成功初始化运行,避免使用 plus 版本导致的语法错误。
本文记录了在 x86_64 麒麟 V10 内网环境中安装 Dify 插件的过程,从日志排查问题,到离线打包插件,确保可以在内网环境下正常运行。特别加入了 Python 版本核查与官方 vs plus 工具差异。
junjiem/mcp_sse:0.2.3dify-plugin-repackaging(注意:不要用 dify-plugin-repackaging-plus,它可能在 Python ≥3.11 下报语法错误)目标:在内网环境下成功安装插件,并解决依赖 gevent==24.11.1 与 Python 版本不兼容问题。
在打包插件之前,必须确认 Python 环境。
python3 --version # 输出示例 Python 3.9.23
which python3.11 whereis python3.11 /usr/bin/python3.11 --version # 输出示例 Python 3.11.13
/usr/bin/python3.11 -m ensurepip --upgrade /usr/bin/python3.11 -m pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/
注意:内网环境可指定
-i国内镜像脚本最好使用官方dify-plugin-repackaging,不要用 plus 版本,否则会报SyntaxError: unmatched ')'
查看 plugin-daemon 日志:
docker logs -f dify-plugin_daemon-1
示例日志:
[INFO]init environment for plugin junjiem/mcp_sse:0.2.3 [ERROR]init environment failed: failed to install dependencies: exit status 1, output: × No solution found when resolving dependencies: ╰─▶ Because gevent==24.11.1 has no wheels with a matching Python ABI tag (e.g., `cp312`) and only gevent==24.11.1 is available, we can conclude that gevent==24.11.1 cannot be used.
failed to install dependencies → 插件初始化失败gevent==24.11.1 has no wheels with a matching Python ABI tag
cd /root/dify/docker/dify-plugin-repackaging chmod +x plugin_repackaging.sh
ls -l
输出示例:
junjiem-mcp_sse_0.2.3.difypkg plugin_repackaging.sh ...
文件名大小写必须正确,路径也必须正确
./plugin_repackaging.sh -p manylinux2014_x86_64 -s linux-amd64 local ./junjiem-mcp_sse_0.2.3.difypkg
输出示例:
local ./junjiem-mcp_sse_0.2.3.difypkg Unziping ... Repackaging Python wheels for manylinux2014_x86_64 ... Packaging completed, output: ./junjiem-mcp_sse_0.2.3_linux-amd64.difypkg
成功生成适配 x86_64 + cp311 的离线插件包
.difypkg 到内网服务器junjiem-mcp_sse_0.2.3_linux-amd64.difypkgdocker logs -f dify-plugin_daemon-1
输出示例:
[INFO]init environment for plugin junjiem/mcp_sse:0.2.3 [INFO]Dependencies found in local package, installing... [INFO]gevent installed successfully [INFO]Plugin junjiem/mcp_sse:0.2.3 initialized successfully
如果插件依赖 numpy 或 dify-plugin,需提前准备离线包:
# 在可联网环境下载依赖 pip download dify-plugin==0.2.1 -d offline_wheels pip download numpy -d offline_wheels pip download gevent==24.11.1 -d offline_wheels # 上传到服务器并安装 pip install --no-index --find-links=/root/offline_wheels dify-plugin numpy gevent
| 工具 | Python 版本兼容 | 适用场景 |
|---|---|---|
dify-plugin-repackaging | 3.9~3.11 | 官方推荐,兼容 x86_64 和 ARM,打包离线插件 |
dify-plugin-repackaging-plus | 3.9 | 脚本在 Python ≥3.11 报语法错误,不推荐内网使用 |
本文全程使用官方
dify-plugin-repackaging
docker logs -f dify-plugin_daemon-1,快速定位网络或 Python 版本问题-p 参数必须与目标架构一致-s 参数仅为输出包后缀--no-index --find-links 或配置内部 PyPI 镜像dify-plugin-repackaging,不要用 plus 版本# 1. 核查 Python 版本 python3 --version /usr/bin/python3.11 --version # 2. 升级 pip(Python3.11) /usr/bin/python3.11 -m ensurepip --upgrade /usr/bin/python3.11 -m pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/ # 3. 打包插件 cd /root/dify/docker/dify-plugin-repackaging chmod +x plugin_repackaging.sh ./plugin_repackaging.sh -p manylinux2014_x86_64 -s linux-amd64 local ./junjiem-mcp_sse_0.2.3.difypkg # 4. 上传到内网服务器,安装插件 # 在 Dify 页面选择本地插件安装 # 5. 内网依赖安装 pip install --no-index --find-links=/root/offline_wheels dify-plugin numpy gevent # 6. 日志检查 docker logs -f dify-plugin_daemon-1

微信公众号「极客日志」,在微信中扫描左侧二维码关注。展示文案:极客日志 zeeklog
生成新的随机RSA私钥和公钥pem证书。 在线工具,RSA密钥对生成器在线工具,online
基于 Mermaid.js 实时预览流程图、时序图等图表,支持源码编辑与即时渲染。 在线工具,Mermaid 预览与可视化编辑在线工具,online
解析常见 curl 参数并生成 fetch、axios、PHP curl 或 Python requests 示例代码。 在线工具,curl 转代码在线工具,online
将字符串编码和解码为其 Base64 格式表示形式即可。 在线工具,Base64 字符串编码/解码在线工具,online
将字符串、文件或图像转换为其 Base64 表示形式。 在线工具,Base64 文件转换器在线工具,online
将 Markdown(GFM)转为 HTML 片段,浏览器内 marked 解析;与 HTML转Markdown 互为补充。 在线工具,Markdown转HTML在线工具,online