Dify在Windows11本地部署无法下载插件问题

可以本地运行dify,但是无法下载插件,求解答
防火墙已关闭

安装失败

failed to launch plugin: failed to create virtual environment: failed to create virtual environment: exit status 2, output: Using CPython 3.12.3 interpreter at: /usr/bin/python3.12 Creating virtual environment at: .venv error: Failed to create virtual environment Caused by: failed to symlink file from /usr/bin/python3.12 to /app/storage/cwd/langgenius/tongyi-0.1.31@638e473191f93192f670875b06edf0bcb89a3433aa736be89ed1749073b8a168/.venv/bin/python: Operation not permitted (os error 1) failed to init environment

在一番摸索和ChatGPT老师的帮助下,问题已解决。

下方为解决方案:

Prompt:
安装失败 failed to launch plugin: failed to create virtual environment: failed to create virtual environment: exit status 2, output: Using CPython 3.12.3 interpreter at: /usr/bin/python3.12 Creating virtual environment at: .venv error: Failed to create virtual environment Caused by: failed to symlink file from /usr/bin/python3.12 to /app/storage/cwd/langgenius/tongyi-0.1.31@638e473191f93192f670875b06edf0bcb89a3433aa736be89ed1749073b8a168/.venv/bin/python: Operation not permitted (os error 1) failed to init environment

实际下载的插件的位置在docker\volumes\plugin_daemon\cwd\langgenius

Response:

你的这个报错其实已经暴露了核心原因
插件下载成功了,但在创建 Python 虚拟环境 .venv 时没有权限创建 symlink(符号链接)

关键报错:

failed to symlink file from /usr/bin/python3.12 
to /app/storage/cwd/langgenius/.../.venv/bin/python
Operation not permitted (os error 1)

意思是:

Docker 容器里的 Python 想创建一个符号链接,但宿主机挂载的目录不允许。

而你又提到插件真实路径在:

docker/volumes/plugin_daemon/cwd/langgenius

这其实就是 Windows 文件系统挂载到 Linux Docker 容器 的典型问题。


一、问题本质(90% 的 Dify 插件安装失败都是这个)

Windows 挂载卷不支持 Linux symlink 权限

Dify 插件安装流程是:

  1. 下载插件源码

  2. 在插件目录创建 .venv

  3. python -m venv

  4. .venv/bin/python 创建 symlink 指向 /usr/bin/python

但:

Windows 文件系统(NTFS)在 Docker 挂载时:

  • 不允许容器创建 symlink

  • 或者需要管理员权限

  • Docker 默认禁止

所以就报:

Operation not permitted


二、推荐解决方案(最稳定)

不要把 plugin_daemon 的 cwd 挂载到 Windows

让它在 Docker volume(Linux文件系统) 里。


修改 docker-compose.yml

找到:

plugin_daemon:

找到这一段:

volumes:
  - ./volumes/plugin_daemon:/app/storage

改成:

volumes:
  - plugin_daemon_storage:/app/storage

然后在文件最后增加:

volumes:
  plugin_daemon_storage:

三、完整重建

然后执行:

1 删除旧容器

docker compose down

2 删除旧 volume

(防止残留)

docker volume prune

或者:

docker volume rm docker_plugin_daemon

3 重新启动

docker compose up -d

五、再安装插件

现在插件路径会变成:

/var/lib/docker/volumes/plugin_daemon_storage/_data/cwd/langgenius

这是 Linux filesystem

可以创建 symlink

虚拟环境就能正常创建。

Windows11完整安装参考资料:

使用 Docker Compose 部署 Dify - Dify Docs

Dify 本地化部署完整指南:从零到成功运行 - 知乎

1 个赞

postgresql报错问题解决方案:

dify安装过程中出现dependency failed to start: container docker-dify-170-db-1 is unhealthy错误的解决方法_dependency failed to start: container docker-db-1 -CSDN博客