How to add advanced dependency such as numpy or pymysql in code excution block? #4804

Closed
opened 2026-02-21 18:08:05 -05:00 by yindo · 1 comment
Owner

Originally created by @DavidYang347 on GitHub (Jul 27, 2024).

Self Checks

  • 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).
  • 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • 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 to add advanced dependency such as numpy or pymysql in code excution blocks? I want to run a python script in code excution block to query a SQL database.

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 @DavidYang347 on GitHub (Jul 27, 2024). ### Self Checks - [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] 请务必使用英文提交 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. How to add advanced dependency such as numpy or pymysql in code excution blocks? I want to run a python script in code excution block to query a SQL database. ### 2. Additional context or comments _No response_ ### 3. Can you help us with this feature? - [X] I am interested in contributing to this feature.
yindo added the 💪 enhancement label 2026-02-21 18:08:05 -05:00
yindo closed this issue 2026-02-21 18:08:05 -05:00
Author
Owner

@crazywoola commented on GitHub (Jul 27, 2024):

You can add packages in this file https://github.com/langgenius/dify/blob/bbef964eb5caaca6df74b21a596900f31faff677/docker/volumes/sandbox/dependencies/python-requirements.txt
and upgrade sandbox to 0.2.4 so that you do not need to add advanced packages manually in the code execution block.

Some of the packages won't be able to start such as numpy and pymysql .

Because TCP is not allowed in sandbox, and numpy requres lots of system configurations .so files.

See FAQ here

https://github.com/langgenius/dify-sandbox/blob/main/FAQ.md

@crazywoola commented on GitHub (Jul 27, 2024): You can add packages in this file https://github.com/langgenius/dify/blob/bbef964eb5caaca6df74b21a596900f31faff677/docker/volumes/sandbox/dependencies/python-requirements.txt and upgrade sandbox to 0.2.4 so that you do not need to add advanced packages manually in the code execution block. Some of the packages won't be able to start such as `numpy` and `pymysql `. Because TCP is not allowed in sandbox, and `numpy` requres lots of system configurations `.so` files. See FAQ here https://github.com/langgenius/dify-sandbox/blob/main/FAQ.md
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4804