Dify 内网离线包安装 (x86架构离线包)
·
以下是个人的尝试教程,自测可用( 可能比较麻烦~ )
大家可以尝试,也可以直接拿包 ~
1、我的环境
网上有很多种方法,我也是借鉴别人的。但是安装过程中还是遇到了一些问题,就整理了下。
[root@localhost ~]# uname -a
Linux localhost.localdomain 5.10.0-60.18.0.50.oe2203.x86_64 #1 SMP Wed Mar 30 03:12:24 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# uname -r
5.10.0-60.18.0.50.oe2203.x86_64
[root@localhost ~]#
2、安装方法
我不确定是不是有更简单的方法,但反正我的跑起来了~
# 1、你需要1台外网的Linux 服务器(下载不下来直接拿我压缩好的文件,直接拿去用)
yum install -y git
git clone https://github.com/junjiem/dify-plugin-repackaging.git
# 2、进入目录,并上传你要重新打包的插件
cd dify-plugin-repackaging
# 3、提权下下载的文件
chmod +x plugin_repackaging.sh
# 4、执行命令,后面的文件替换为你要重新编译的文件(从外网环境下载下的包是无法放在内网用的,还是需要下载依赖,因此这个脚本就是预先下载离线依赖重新打包)
./plugin_repackaging.sh local ./langgenius-openai_api_compatible_0.0.16.difypkg
————————————————————————————————————————
# 遇到的问题
# Q1:在尝试使用 pip 安装依赖时,找不到符合版本要求的 dify_plugin 包:
ERROR: Could not find a version that satisfies the requirement dify_plugin<0.3.0,>=0.2.0 (from versions: 0.0.1b14, 0.0.1b15, 0.0.1b16, 0.0.1b17, 0.0.1b18, 0.0.1b19, 0.0.1b20, 0.0.1b21, 0.0.1b22)
ERROR: No matching distribution found for dify_plugin<0.3.0,>=0.2.0
Pip download failed.
# 1、必须升级Python到 3.11 ,以支持 dify_plugin<0.3.0,>=0.2.0
# 1-1:下载编译环境
sudo dnf groupinstall "Development Tools" -y
sudo dnf install -y gcc openssl-devel bzip2-devel libffi-devel wget make zlib-devel xz-devel
# 1-2:下载 Python 包
cd /usr/src && sudo wget --no-check-certificate https://www.python.org/ftp/python/3.12.7/Python-3.12.7.tgz && tar -xf Python-3.12.7.tgz && cd Python-3.12.7
# 1-3:编译安装 编译了我10分钟
./configure --enable-optimizations
make altinstall
# 1-4:验证安装
python3.12 --version
# 1-5:安装 pip(Python 3.11 自带 ensurepip)
python3.12 -m ensurepip
python3.12 -m pip --version
# 1-6:安装 dify_plugin(Python 3.11 环境下)
python3.12 -m pip install dify_plugin==0.2.4
# 或者从本地安装 你传下
# https://pypi.org/project/dify_plugin/0.2.4/
# python3.12 -m pip install dify_plugin-0.2.4.tar.gz
# 1-7:确认插件版本
python3.12 -c "import dify_plugin; print(dify_plugin.__version__)"
# 1-8:使用虚拟环境打包
python3.12 -m venv venv
source venv/bin/activate
安装插件及依赖(带预发布支持)
pip install --pre dify_plugin==0.2.4
pip install langgenius-openai-api-compatible==0.0.16 --no-cache-dir
# 1-9:再次尝试打包
./plugin_repackaging.sh local langgenius-openai_api_compatible_0.0.16.difypkg
3、Dify 配置
# 进入dify的docker目录
# Dify商场无法上传太大的文件,因此需要改下配置
vi .env
FORCE_VERIFYING_SIGNATURE 改为 false
PLUGIN_MAX_PACKAGE_SIZE 增大为 524288000
NGINX_CLIENT_MAX_BODY_SIZE 增大为 500M
# 重启dify
更多推荐
所有评论(0)