dify - 💡(How to fix) Fix [Bug] Python code sandbox fails: '/usr/local/bin/python3: no such file or directory' – workaround available [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langgenius/dify#36002Fetched 2026-05-11 03:29:01
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
1
Author
Timeline (top)
commented ×2closed ×1labeled ×1mentioned ×1

Error Message

tool invoke error: Got error code: -500. Got error msg: fork/exec /usr/local/bin/python3: no such file or directory

Fix Action

Fix / Workaround

Workaround: Create a symlink (in sandbox container) so the code runner can find Python:

mkdir -p /usr/local/bin
ln -sf /opt/python/bin/python3 /usr/local/bin/python3

Now tools/skills/code execution should work until the container is rebuilt/recreated.

Code Example

tool invoke error: Got error code: -500. Got error msg: fork/exec /usr/local/bin/python3: no such file or directory

---

mkdir -p /usr/local/bin
ln -sf /opt/python/bin/python3 /usr/local/bin/python3
RAW_BUFFERClick to expand / collapse

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

latest (May 2026)

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Steps to reproduce:

  1. Deploy Dify (self-hosted, Docker stack).
  2. Run a workflow or tool that calls the Python code sandbox (e.g., Code Interpreter, Python skills).
  3. Error is returned:
tool invoke error: Got error code: -500. Got error msg: fork/exec /usr/local/bin/python3: no such file or directory
  1. Enter sandbox/code execution container.
  2. Verify that /usr/local/bin/python3 does not exist, but Python is at a different path (e.g., /opt/python/bin/python3).

Workaround: Create a symlink (in sandbox container) so the code runner can find Python:

mkdir -p /usr/local/bin
ln -sf /opt/python/bin/python3 /usr/local/bin/python3

Now tools/skills/code execution should work until the container is rebuilt/recreated.

✔️ Expected Behavior

Code execution tools should work out of the box, without path errors, after deployment.

❌ Actual Behavior

With default Docker image or deployment, the code execution sandbox container may miss /usr/local/bin/python3, generating errors when code interpretation is triggered. Creating a symlink to the actual python binary fixes the problem, but this is not persistent (will be lost when the container is recreated).

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING