Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'base64' module not found in the sandbox environment. #14371

Closed
5 tasks done
SharkSyl opened this issue Feb 26, 2025 · 4 comments
Closed
5 tasks done

'base64' module not found in the sandbox environment. #14371

SharkSyl opened this issue Feb 26, 2025 · 4 comments
Labels
🐞 bug Something isn't working

Comments

@SharkSyl
Copy link

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

langgenius/dify-sandbox:0.2.10

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

The error below occurs when running a code block in the workflow.

I used a Docker image: 'langgenius/dify-sandbox:0.2.10'

2025-02-26T02:24:11.490801317Z Metadata: 
2025-02-26T02:24:11.492465937Z 
2025-02-26T02:24:11.492476729Z [NodeRunStartedEvent]
2025-02-26T02:24:11.492480133Z Node ID: 1735807351780
2025-02-26T02:24:11.492483120Z Node Title: context
2025-02-26T02:24:11.492494352Z Type: code
2025-02-26T02:24:11.600529865Z [GIN]2025/02/26 - 02:24:11 |200 |   40.276919ms |   192.168.144.4 | POST     "/v1/sandbox/run"
2025-02-26T02:24:11.601093317Z2025-02-26 02:24:11.600 INFO [Thread-946 (_generate_worker)] [_client.py:1038] - HTTP Request: POST http://sandbox:8194/v1/sandbox/run "HTTP/1.1200 OK"
2025-02-26T02:24:11.602534799Z 
2025-02-26T02:24:11.602555376Z [NodeRunFailedEvent]
2025-02-26T02:24:11.602559770Z Node ID: 1735807351780
2025-02-26T02:24:11.602563422Z Node Title: context
2025-02-26T02:24:11.602567310Z Type: code
2025-02-26T02:24:11.602570639Z Error: Traceback (most recent call last):
2025-02-26T02:24:11.602575133Z   File "/tmp/code/c3b6ccbb_f7a2_4b16_b567_73dfaf974a85.py", line 61, in <module>
2025-02-26T02:24:11.602578710Z ModuleNotFoundError: No module named 'base64'
2025-02-26T02:24:11.602581713Z error: exit status255

Is it an issue with version 0.2.10?"

✔️ Expected Behavior

The code should execute successfully.

❌ Actual Behavior

same with Issue 8151

@dosubot dosubot bot added the 🐞 bug Something isn't working label Feb 26, 2025
Copy link

dosubot bot commented Feb 26, 2025

@SharkSyl Hello there! I'm here to assist you with any bugs, questions, or contributions you may have. Let's tackle this issue together!

The base64 module is a standard Python library and should typically be available by default. However, if you're encountering a ModuleNotFoundError for base64 in the Dify sandbox environment, it might be due to specific restrictions or configurations in the sandbox.

To resolve this, you can try adding the base64 module explicitly to the sandbox environment. You can do this by modifying the python-requirements.txt file located at docker/volumes/sandbox/dependencies/ and adding base64 to it. This should ensure that the module is available in your sandbox environment [1].

If the issue persists, it might be worth checking if there are any specific configurations or restrictions in the sandbox environment that could be affecting the import of standard Python modules.

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

@SharkSyl
Copy link
Author

@dosu
I can import from the container.

docker-compose exec sandbox bash
root@eb9eebfe1b77:/# python3
Python 3.10.14 (main, Apr 24 2024, 12:40:18) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import base64
>>>

Copy link

dosubot bot commented Feb 26, 2025

Could you provide more details about the specific code block or script you're trying to run in the sandbox environment that results in the ModuleNotFoundError? Additionally, are there any custom configurations or environment variables set in your Docker setup that might affect the Python environment within the sandbox?

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

@crazywoola
Copy link
Member

Please open an issue here instead https://github.com/langgenius/dify-sandbox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants