Skip to content

Instantly share code, notes, and snippets.

@kurokobo
Created March 5, 2025 14:17
Show Gist options
  • Save kurokobo/40808c757a6750da387a058616258836 to your computer and use it in GitHub Desktop.
Save kurokobo/40808c757a6750da387a058616258836 to your computer and use it in GitHub Desktop.
[Dify] Workarounds for the plugin related issues on self-hosted 1.0.0 on Docker Desktop on Windows

🛠️ Workarounds for the plugin related issues for Dify 1.0.0 on Docker Desktop on Windows

In Dify 1.0.0, many issues related to plugins have been reported. If you are self-hosting Dify using Docker Desktop on Windows, the workarounds introduced on this page might be helpful.

Important

This page is intended for the following environments.

  • Dify Community Edition (Self-Hosted) 1.0.0
  • Docker Desktop on Windows

👣 Steps to reproduce

  1. Deploy fresh 1.0.0 with default .env file on Docker Desktop on Windows
  2. Try to install some plugins e.g. langgenius/openai

✔️ Expected Behavior

The plugins have been successfully installed. Users can configure models using those plugins and utilize them from the apps.

❌ Actual Behavior

One of the following situations may occur:

  • The plugin installation fails in GUI.
  • Multiple attempts are required before the plugin installation is successful in GUI.
  • The installed plugin does not function as expected.
  • API keys for the models cannot be saved.
  • Following logs are recored in the logs of plugin_daemon container.
    • [ERROR]init environment failed: failed to install dependencies: signal: killed, output: init process exited due to no activity for 120 seconds, retry in 30s

    • [ERROR]PluginDaemonInternalServerError: killed by timeout

  • Following logs are recored in the logs of api container.
    • PluginDaemonInternalServerError: no available node, plugin not found

    • PluginDaemonInternalServerError: killed by timeout

🐛 Causes

This issue is mainly caused by the following two factors:

  • The performance of volumes on Docker Desktop for Windows is extremely slow, causing the installation process of the plugin to not complete within the expected time; the log output from the init process stops for more than 120 seconds, causing installation failure.
  • Even though the installation has not actually been completed, there are cases where the Plugin Daemon reports to the API server that the plugin has already been installed. I have not identified the root cause of this yet, further investigation is required for this.

💡Workarounds

For users who are on self-hosted on Docker Desktop on Windows, one of the following workaround can be applied.

Important

After you've applied thw workaround, restart whole Dify instance and re-install the plugins. Before you proceed configuring plugins, ensure all plugins are successfully installed and there are no errors in the logs of plugin daemon container.

✅ A) Place whole your docker folder on the WSL filesystem

When Docker Volume is placed on NTFS, performance degrades and the likelihood of plugin installation failures increases.

By placing the entire docker folder within the WSL filesystem, performance dramatically improves, and this issue becomes less frequent.

✅ B) Increase PYTHON_ENV_INIT_TIMEOUT

Edit your docker-compose.yml and add PYTHON_ENV_INIT_TIMEOUT to the environment of plugin_daemon, setting it to a larger value like 600.

This will extend the wait time to 600 seconds, instead of the default 120 seconds. Depending on your environment, you may need to increase this number even more.

✅ C) Change the plugin working path by PLUGIN_WORKING_PATH

Add a new line PLUGIN_WORKING_PATH=/app/cwd to your .env.

By changing the plugin working path, the installation destination is changed from Docker Volume to the local file system of the container, it improves performance and mitigates the occurrence of this issue.

Note, as a side effect, the plugin installation process will run every time the plugin daemon container restarts.

❓ Still facing errors ?

Search exsiting issues on the official repo!

@codersboutique
Copy link

Hi there,

I am self-hosting on windows using docker and when i try to add openai key or anthorpic key. it doesn't work. so while researching i found your gists.

while following these steps i see the my docker-compose.yaml is auto-generated and do not modify this file directly.

should i still add python env init under x-shared-env:

pls suggest. i am new to this.

@kurokobo
Copy link
Author

kurokobo commented Mar 9, 2025

@codersboutique
It's okay to edit the docker-compose.yaml directly. Note that you should edit it again after updating the Dify version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment