Add an Extension Parameter for the pip Command in Plugins
Self Checks
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [x] Please do not modify this template :) and fill in all the required fields.
1. Is this request related to a challenge you're experiencing? Tell me about your story.
When using Dify offline, I am unable to correctly install plugin dependencies, even though I know they are missing. I have tried many solutions.
# First, I enter the plugin container bash on a computer that can connect to the internet:
pip download -r "plugin dir/requirements.txt"
# Then, on the offline environment, I use /usr/bin/pip to install the dependencies:
pip install -r "plugin dir/requirements.txt" --no-index --find-links=/app/packages
The installation succeeds, but it doesn't work as expected. I think the issue might be that different plugins use a Python environment different from "/usr/bin/pip." So, I used the "PIP_MIRROR_URL" parameter, which requires setting up an additional "pypiserver" in the offline environment. Even though I set it up, the plugin container can "search," but it cannot "pip install":
pip search numpy -i http://10.xxx.xxx.xxx:xx
>> numpy 2.2.3
pip install numpy -i http://10.xxx.xxx.xxx:xx
Maybe there is an issue with how I set up "pypiserver," but setting it up is undoubtedly extra work. Therefore, I hope to replace the "PIP_MIRROR_URL" parameter with a "PIP_COMMAND_EXTEND" option:
PIP_COMMAND_EXTEND='-i https://pypi.org/simple'
# or
PIP_COMMAND_EXTEND="--no-index --find-links=/app/packages"
This would offer more flexibility.
2. Additional context or comments
No response
3. Can you help us with this feature?
- [x] I am interested in contributing to this feature.
The following is the Chinese translation of the previous text
我在离线使用dify时,无法正确安装插件依赖,尽管我知道他缺少依赖包,我尝试过很多办法。
# 首先我在能联网的电脑进入plugin 容器 bash
pip download -r "plugin dir/requirements.txt"
# 然后到离线环境
/usr/bin/pip install -r "plugin dir/requirements.txt" --no-index --find-links=/app/packages
安装成功了,但是这样不管用,我觉得可能是不同的插件使用的python环境与”/usr/bin/pip“的不一样。
好的,我使用“PIP_MIRROR_URL”参数,这需要我在离线环境中额外搭建”pypiserver“。 尽管我搭建了,但是plugin容器虽然可以“search”到,但是无法”pip install“
pip serach numpy -i http://10.xxx.xxx.xxx:xx
>> numpy 2.2.3
pip install numpy -i http://10.xxx.xxx.xxx:xx
也许是我"pypiserver"搭建有问题吧,但是搭建"pypiserver",无疑是额外的工作。
因此我希望能将"PIP_MIRROR_URL"参数改为"PIP_COMMAND_EXTEND"
PIP_COMMAND_EXTEND='-i https:///pypi.org/simple'
# 或者
PIP_COMMAND_EXTEND="--no-index --find-links=/app/packages"
这样更灵活一些。
Pretty good suggestion.
The following is the Chinese translation of the previous text
我在离线使用dify时,无法正确安装插件依赖,尽管我知道他缺少依赖包,我尝试过很多办法。
首先我在能联网的电脑进入plugin 容器 bash
pip download -r "plugin dir/requirements.txt"
然后到离线环境
/usr/bin/pip install -r "plugin dir/requirements.txt" --no-index --find-links=/app/packages 安装成功了,但是这样不管用,我觉得可能是不同的插件使用的python环境与”/usr/bin/pip“的不一样。
好的,我使用“PIP_MIRROR_URL”参数,这需要我在离线环境中额外搭建”pypiserver“。 尽管我搭建了,但是plugin容器虽然可以“search”到,但是无法”pip install“
pip serach numpy -i http://10.xxx.xxx.xxx:xx
numpy 2.2.3 pip install numpy -i http://10.xxx.xxx.xxx:xx 也许是我"pypiserver"搭建有问题吧,但是搭建"pypiserver",无疑是额外的工作。
因此我希望能将"PIP_MIRROR_URL"参数改为"PIP_COMMAND_EXTEND"
PIP_COMMAND_EXTEND='-i https:///pypi.org/simple'
或者
PIP_COMMAND_EXTEND="--no-index --find-links=/app/packages" 这样更灵活一些。
Hi, the args you want already exists, it names PIP_EXTRA_ARGS
@Yeuoly
What can I fill in this extension parameter? Because initially, I wanted to bypass' - i 'to specify the local path. It seems that dify has already defaulted to assembling the "- i" parameter inside, but if so, the "PIPEXTRA_SRGS" parameter still cannot be bypassed. 这个扩展参数我能够填写什么?因为一开始,我是想绕过"-i"来指定本地路径。好像dify已经默认拼装"-i"参数在里面,如果是这样“PIP_EXTRA_ARGS”参数仍然无法绕过。
Perhaps I set up 'PIP_SIRROR-URL', so I spelled '- i' (because I didn't know there was' PIPEXTRA_SRGS' at the beginning). However, I have already completed the deployment by setting up Pypiserver. 也许是我设置了“PIP_MIRROR_URL”,所以就会拼“-i”(因为我一开始不知道有“PIP_EXTRA_ARGS”)。 不过我已经通过搭建pypiserver完成部署了。
What can I fill in this extension parameter? Because initially, I wanted to bypass' - i 'to specify the local path. It seems that dify has already defaulted to assembling the "- i" parameter inside, but if so, the "PIPEXTRA_SRGS" parameter still cannot be bypassed. 这个扩展参数我能够填写什么?因为一开始,我是想绕过"-i"来指定本地路径。好像dify已经默认拼装"-i"参数在里面,如果是这样“PIP_EXTRA_ARGS”参数仍然无法绕过。
Perhaps I set up 'PIP_SIRROR-URL', so I spelled '- i' (because I didn't know there was' PIPEXTRA_SRGS' at the beginning). However, I have already completed the deployment by setting up Pypiserver. 也许是我设置了“PIP_MIRROR_URL”,所以就会拼“-i”(因为我一开始不知道有“PIP_EXTRA_ARGS”)。 不过我已经通过搭建pypiserver完成部署了。
It's because you have already added PIP_MIRROR_URL, it's duplicate
Great, the deployment now looks more elegant. I was really clumsy at manually rubbing the pip source before. 太棒了,这下部署显得更优雅了,之前手搓pip源真是太拙劣了。