After adding pandas to python-requirements.txt file in sandbox, the code execution module reported the error Run Failed: Error: Operation Not Permitted. #15548

Closed
opened 2026-02-21 19:22:15 -05:00 by yindo · 2 comments
Owner

Originally created by @jizhuwojiaopaozong on GitHub (Jul 21, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.6.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Add pandas to the docker/volumes/sandbox/dependencies/python-requirements.txt file in the project directory, and then restart the sandbox service. pandas executes import pandas as pd in the code execution environment to report an error: error: operation not permitted.

The code in the code execution module is as follows:
`import pandas as pd

def main(data: list) -> dict:
return {
"result": "1"
}
`

✔️ Expected Behavior

After pouring pandas package, it can run normally without error.

Actual Behavior

Error: run failed: error: operation not permitted.

Originally created by @jizhuwojiaopaozong on GitHub (Jul 21, 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] 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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.6.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Add pandas to the docker/volumes/sandbox/dependencies/python-requirements.txt file in the project directory, and then restart the sandbox service. pandas executes import pandas as pd in the code execution environment to report an error: error: operation not permitted. The code in the code execution module is as follows: `import pandas as pd def main(data: list) -> dict: return { "result": "1" } ` ### ✔️ Expected Behavior After pouring pandas package, it can run normally without error. ### ❌ Actual Behavior Error: run failed: error: operation not permitted.
yindo added the 🐞 bug label 2026-02-21 19:22:15 -05:00
yindo closed this issue 2026-02-21 19:22:15 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 21, 2025):

This error is likely caused by the sandbox Docker image restricting certain system calls or permissions that pandas (or its dependencies like NumPy) require. The Dify sandbox runs with default Docker security settings and does not specify custom seccomp, AppArmor, or user privileges in its docker-compose configuration. If pandas needs system-level operations that are blocked by the sandbox, you'll see "Operation Not Permitted" errors, and these can't be changed from the Dify config layer alone—the restriction comes from the sandbox image itself and Docker's security model1 2 3 .

To troubleshoot or work around this:

  • Check the full error log or stack trace from the sandbox to see if a specific syscall or operation is being blocked.
  • Try running the sandbox container with elevated privileges (e.g., add privileged: true or adjust security_opt in your docker-compose for testing).
  • If that works, consider building a custom sandbox image with relaxed security settings or a modified seccomp profile to allow the necessary operations.
  • For advanced Python packages that require more system access, you may need to run code outside the sandbox or use a different execution environment.

For more on Docker container security and privilege management, see the Docker documentation.

To reply, just mention @dosu.


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

@dosubot[bot] commented on GitHub (Jul 21, 2025): <!-- Answer --> This error is likely caused by the sandbox Docker image restricting certain system calls or permissions that pandas (or its dependencies like NumPy) require. The Dify sandbox runs with default Docker security settings and does not specify custom seccomp, AppArmor, or user privileges in its docker-compose configuration. If pandas needs system-level operations that are blocked by the sandbox, you'll see "Operation Not Permitted" errors, and these can't be changed from the Dify config layer alone—the restriction comes from the sandbox image itself and Docker's security model[^1][^2][^3]. To troubleshoot or work around this: - Check the full error log or stack trace from the sandbox to see if a specific syscall or operation is being blocked. - Try running the sandbox container with elevated privileges (e.g., add `privileged: true` or adjust `security_opt` in your docker-compose for testing). - If that works, consider building a custom sandbox image with relaxed security settings or a modified seccomp profile to allow the necessary operations. - For advanced Python packages that require more system access, you may need to run code outside the sandbox or use a different execution environment. For more on Docker container security and privilege management, see the [Docker documentation](https://docs.docker.com/engine/security/seccomp/). [^1]: [docker-compose.yaml sandbox config](https://github.com/langgenius/dify/blob/eb06de0921938dfa7743f12b443246f8c657b6d5/docker/docker-compose.yaml) [^2]: [sandbox config.yaml](https://github.com/langgenius/dify/blob/eb06de0921938dfa7743f12b443246f8c657b6d5/docker/volumes/sandbox/conf/config.yaml) [^3]: [code execution module](https://github.com/langgenius/dify/blob/eb06de0921938dfa7743f12b443246f8c657b6d5/api/core/helper/code_executor/code_executor.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/6faf3575-535e-4f56-8f44-bb693405c9cc?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/6faf3575-535e-4f56-8f44-bb693405c9cc?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/6faf3575-535e-4f56-8f44-bb693405c9cc?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/6faf3575-535e-4f56-8f44-bb693405c9cc?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6faf3575-535e-4f56-8f44-bb693405c9cc?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/6faf3575-535e-4f56-8f44-bb693405c9cc?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6faf3575-535e-4f56-8f44-bb693405c9cc?feedback_type=other)</sup>&nbsp;&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/22753)
Author
Owner

@nemoiee commented on GitHub (Jul 25, 2025):

I encountered the same issue, and setting privileged: true did not resolve it.

@nemoiee commented on GitHub (Jul 25, 2025): I encountered the same issue, and setting `privileged: true` did not resolve it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#15548