Deploying dify in offline environment and using ollama cannot add models #13413

Closed
opened 2026-02-21 19:12:04 -05:00 by yindo · 1 comment
Owner

Originally created by @maijing274 on GitHub (Apr 27, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.2.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I downloaded dify and deployed it in Docker on a Windows computer with internet access, and installed all the Olama plugins in dify. In a networked environment, package all the Docker images required by dify and transfer them to the Windows system on the intranet. After deployment, it is not possible to add the OLLME model in dify。
he following are the Docker logs on the intranet。

2025-04-27 15:02:48 2025/04/27 07:02:48 runtime_lifetime.go:86: [ERROR]init environment failed: failed to install dependencies: exit status 2, output: error: Failed to fetch: https://pypi.org/simple/numpy/
2025-04-27 15:02:48 Caused by: Could not connect, are you offline?
2025-04-27 15:02:48 Caused by: Request failed after 3 retries
2025-04-27 15:02:48 Caused by: error sending request for url (https://pypi.org/simple/numpy/)
2025-04-27 15:02:48 Caused by: client error (Connect)
2025-04-27 15:02:48 Caused by: dns error: failed to lookup address information: Name or service not known
2025-04-27 15:02:48 Caused by: failed to lookup address information: Name or service not known
2025-04-27 15:02:48 , retry in 30s
2025-04-27 15:03:18 2025/04/27 07:03:18 runtime_lifetime.go:80: [INFO]init environment for plugin langgenius/ollama:0.0.5
2025-04-27 15:03:34 2025/04/27 07:03:34 runtime_lifetime.go:86: [ERROR]init environment failed: failed to install dependencies: exit status 2, output: error: Failed to fetch: https://pypi.org/simple/dify-plugin/
2025-04-27 15:03:34 Caused by: Could not connect, are you offline?
2025-04-27 15:03:34 Caused by: Request failed after 3 retries
2025-04-27 15:03:34 Caused by: error sending request for url (https://pypi.org/simple/dify-plugin/)
2025-04-27 15:03:34 Caused by: client error (Connect)
2025-04-27 15:03:34 Caused by: dns error: failed to lookup address information: Name or service not known
2025-04-27 15:03:34 Caused by: failed to lookup address information: Name or service not known
2025-04-27 15:03:34 , retry in 30s
2025-04-27 15:04:04 2025/04/27 07:04:04 runtime_lifetime.go:80: [INFO]init environment for plugin langgenius/ollama:0.0.5
2025-04-27 15:04:18 2025/04/27 07:04:18 runtime_lifetime.go:86: [ERROR]init environment failed: failed to install dependencies: exit status 2, output: error: Failed to fetch: https://pypi.org/simple/numpy/

Image
Image

✔️ Expected Behavior

Olama successfully added the model

Actual Behavior

Ollama clicking to add model has no response

Originally created by @maijing274 on GitHub (Apr 27, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.2.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I downloaded dify and deployed it in Docker on a Windows computer with internet access, and installed all the Olama plugins in dify. In a networked environment, package all the Docker images required by dify and transfer them to the Windows system on the intranet. After deployment, it is not possible to add the OLLME model in dify。 he following are the Docker logs on the intranet。 2025-04-27 15:02:48 2025/04/27 07:02:48 runtime_lifetime.go:86: [ERROR]init environment failed: failed to install dependencies: exit status 2, output: error: Failed to fetch: `https://pypi.org/simple/numpy/` 2025-04-27 15:02:48 Caused by: Could not connect, are you offline? 2025-04-27 15:02:48 Caused by: Request failed after 3 retries 2025-04-27 15:02:48 Caused by: error sending request for url (https://pypi.org/simple/numpy/) 2025-04-27 15:02:48 Caused by: client error (Connect) 2025-04-27 15:02:48 Caused by: dns error: failed to lookup address information: Name or service not known 2025-04-27 15:02:48 Caused by: failed to lookup address information: Name or service not known 2025-04-27 15:02:48 , retry in 30s 2025-04-27 15:03:18 2025/04/27 07:03:18 runtime_lifetime.go:80: [INFO]init environment for plugin langgenius/ollama:0.0.5 2025-04-27 15:03:34 2025/04/27 07:03:34 runtime_lifetime.go:86: [ERROR]init environment failed: failed to install dependencies: exit status 2, output: error: Failed to fetch: `https://pypi.org/simple/dify-plugin/` 2025-04-27 15:03:34 Caused by: Could not connect, are you offline? 2025-04-27 15:03:34 Caused by: Request failed after 3 retries 2025-04-27 15:03:34 Caused by: error sending request for url (https://pypi.org/simple/dify-plugin/) 2025-04-27 15:03:34 Caused by: client error (Connect) 2025-04-27 15:03:34 Caused by: dns error: failed to lookup address information: Name or service not known 2025-04-27 15:03:34 Caused by: failed to lookup address information: Name or service not known 2025-04-27 15:03:34 , retry in 30s 2025-04-27 15:04:04 2025/04/27 07:04:04 runtime_lifetime.go:80: [INFO]init environment for plugin langgenius/ollama:0.0.5 2025-04-27 15:04:18 2025/04/27 07:04:18 runtime_lifetime.go:86: [ERROR]init environment failed: failed to install dependencies: exit status 2, output: error: Failed to fetch: `https://pypi.org/simple/numpy/` ![Image](https://github.com/user-attachments/assets/c6595f9f-3407-4930-b13c-fed01b971223) ![Image](https://github.com/user-attachments/assets/e3d7fad7-238e-4593-8c01-0f0d3044ef6d) ### ✔️ Expected Behavior Olama successfully added the model ### ❌ Actual Behavior Ollama clicking to add model has no response
yindo added the 🤔 cant-reproduce label 2026-02-21 19:12:04 -05:00
yindo closed this issue 2026-02-21 19:12:04 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 27, 2025):

Hello @maijing274! I'm Dosu, your friendly bot here to help with bugs, answer questions, and guide you in becoming a contributor. While you wait for a human maintainer, feel free to ask me anything. 😊

I found similar threads discussing issues with deploying Dify in offline environments and adding Ollama models:

  1. dify1.0.0 cannot be used offline: This discussion highlights challenges with offline deployment, similar to your situation [1].

  2. Can't add the Ollama Models: This thread addresses issues with adding Ollama models, suggesting network configuration adjustments [2].

To resolve the network connectivity issues and dependency installation failures in your offline Dify deployment, follow these steps:

  1. Set Up a Local PyPI Mirror: Configure your Docker setup to use a local or alternative PyPI mirror by setting the PIP_MIRROR_URL environment variable in your docker-compose.yaml or .env file. For example, use 'https://pypi.tuna.tsinghua.edu.cn/simple' to bypass DNS resolution issues [3].

  2. Adjust Docker Network Configuration: Ensure that the Docker containers can access the host machine's network. Use http://host.docker.internal:11434 in your Ollama configuration to allow Docker containers to access services running on the host machine [4].

  3. Offline Deployment Steps: In an online environment, deploy Dify and install all required dependencies. Export plugin data and package the Docker images. Transfer these to the offline environment, load the images, and replace the volume data. Modify the Docker configuration to use the uploaded images and restart the containers [5].

By following these steps, you should be able to resolve the dependency installation issues and successfully add the Ollama model in your offline Dify deployment.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Apr 27, 2025): <!-- Greeting --> Hello @maijing274! I'm [Dosu](https://dosu.dev), your friendly bot here to help with bugs, answer questions, and guide you in becoming a contributor. While you wait for a human maintainer, feel free to ask me anything. 😊 <!-- Answer --> I found similar threads discussing issues with deploying Dify in offline environments and adding Ollama models: 1. **[dify1.0.0 cannot be used offline](https://github.com/langgenius/dify/discussions/15138)**: This discussion highlights challenges with offline deployment, similar to your situation <sup>[[1]](https://github.com/langgenius/dify/discussions/15138)</sup>. 2. **[Can't add the Ollama Models](https://github.com/langgenius/dify/discussions/12336)**: This thread addresses issues with adding Ollama models, suggesting network configuration adjustments <sup>[[2]](https://github.com/langgenius/dify/discussions/12336)</sup>. To resolve the network connectivity issues and dependency installation failures in your offline Dify deployment, follow these steps: 1. **Set Up a Local PyPI Mirror**: Configure your Docker setup to use a local or alternative PyPI mirror by setting the `PIP_MIRROR_URL` environment variable in your `docker-compose.yaml` or `.env` file. For example, use 'https://pypi.tuna.tsinghua.edu.cn/simple' to bypass DNS resolution issues <sup>[[3]](https://github.com/langgenius/dify/issues/16418)</sup>. 2. **Adjust Docker Network Configuration**: Ensure that the Docker containers can access the host machine's network. Use `http://host.docker.internal:11434` in your Ollama configuration to allow Docker containers to access services running on the host machine <sup>[[4]](https://github.com/langgenius/dify/issues/14331)</sup>. 3. **Offline Deployment Steps**: In an online environment, deploy Dify and install all required dependencies. Export plugin data and package the Docker images. Transfer these to the offline environment, load the images, and replace the volume data. Modify the Docker configuration to use the uploaded images and restart the containers <sup>[[5]](https://github.com/langgenius/dify/issues/15627)</sup>. By following these steps, you should be able to resolve the dependency installation issues and successfully add the Ollama model in your offline Dify deployment. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/597bc322-3224-4dee-82d1-321f81928a98?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/597bc322-3224-4dee-82d1-321f81928a98?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/597bc322-3224-4dee-82d1-321f81928a98?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/597bc322-3224-4dee-82d1-321f81928a98?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/597bc322-3224-4dee-82d1-321f81928a98?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/597bc322-3224-4dee-82d1-321f81928a98?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/597bc322-3224-4dee-82d1-321f81928a98?feedback_type=other)</sup>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13413