Code node error,how to install dependencies of the code node needs? #16357

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

Originally created by @nors1993 on GitHub (Aug 22, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 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.

how can I install dependencies in Code node? thx~

Image

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @nors1993 on GitHub (Aug 22, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [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. how can I install dependencies in Code node? thx~ <img width="725" height="281" alt="Image" src="https://github.com/user-attachments/assets/14735fe3-9322-4b09-bd26-dbaacb95b005" /> ### 2. Additional context or comments _No response_ ### 3. Can you help us with this feature? - [ ] I am interested in contributing to this feature.
yindo added the 🙋‍♂️ question label 2026-02-21 19:25:47 -05:00
yindo closed this issue 2026-02-21 19:25:47 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 22, 2025):

Currently, you can't install arbitrary dependencies directly in the Code node from the UI or workflow. The Code node runs your code in a secure sandbox with a pre-installed, curated set of Python (and JavaScript) packages. This means libraries like matplotlib may not be available unless they're already included in the sandbox environment. Extending the available libraries requires changes to the backend sandbox image by the maintainers, not by end users. This restriction is in place for security and stability reasons, and there are no user-level options for installing additional dependencies at runtime or via requirements files.
If you need a specific library, you'll need to request that the maintainers add it to the sandbox environment.
Reference

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Aug 22, 2025): <!-- Answer --> Currently, you can't install arbitrary dependencies directly in the Code node from the UI or workflow. The Code node runs your code in a secure sandbox with a pre-installed, curated set of Python (and JavaScript) packages. This means libraries like `matplotlib` may not be available unless they're already included in the sandbox environment. Extending the available libraries requires changes to the backend sandbox image by the maintainers, not by end users. This restriction is in place for security and stability reasons, and there are no user-level options for installing additional dependencies at runtime or via requirements files. If you need a specific library, you'll need to request that the maintainers add it to the sandbox environment. [Reference](https://github.com/langgenius/dify/blob/2a43e634e83f98c59776f479c3c0e68e648e53b3/api/core/workflow/nodes/code/code_node.py) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/6d8c71c7-6445-4bdd-8ba3-6bc278311d48?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/6d8c71c7-6445-4bdd-8ba3-6bc278311d48?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/6d8c71c7-6445-4bdd-8ba3-6bc278311d48?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/6d8c71c7-6445-4bdd-8ba3-6bc278311d48?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6d8c71c7-6445-4bdd-8ba3-6bc278311d48?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/6d8c71c7-6445-4bdd-8ba3-6bc278311d48?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6d8c71c7-6445-4bdd-8ba3-6bc278311d48?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/24339)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#16357