The code execution unit in the workflow of dify cloud Version 0.6.12-fix1 is unable to use the "requests" library properly
Self Checks
- [X] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [X] I have searched for existing issues search for existing issues, including closed ones.
- [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [X] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [X] Please do not modify this template :) and fill in all the required fields.
Dify version
0.6.12-fix1
Cloud or Self Hosted
Cloud
Steps to reproduce
import requests
def main() -> dict:
response = requests.get('https://www.baidu.com/')
if response.status_code == 200:
result = "123"
else:
result=" "
return {
"result": result,
}
✔️ Expected Behavior
success work
❌ Actual Behavior
runtime error:/usr/local/lib/python3.10/site-packages/requests/init.py:86: RequestsDependencyWarning: Unable to find acceptable character detection dependency (chardet or charset_normalizer). warnings.warn(
To resolve the RequestsDependencyWarning due to missing character detection dependencies (chardet or charset_normalizer) in the code execution unit of Dify Cloud Version 0.6.12-fix1, you need to install the missing dependencies. Here is how you can do it:
-
Install
chardetorcharset_normalizerusing pip:pip install chardetor
pip install charset_normalizer -
Add the dependencies to your Docker setup:
If you are using Docker, you can add the dependencies to your Dockerfile. Here is an example of how to modify your Dockerfile to include
chardet:FROM python:3.8-slim # Install dependencies RUN pip install chardet # Copy your application code COPY . /app # Set the working directory WORKDIR /app # Run your application CMD ["python", "your_application.py"] -
Rebuild and restart your Docker containers:
docker compose down docker compose build docker compose up -d
By following these steps, you should be able to resolve the RequestsDependencyWarning by ensuring that the necessary character detection dependencies are installed [1].
To continue talking to Dosu, mention @dosu.
Does this issue exists in earlier version?
Does this issue exists in earlier version? no,i can use it correctly in 2024/06/25.
get the same issue on 0.6.14
Is the only way to modify the Dockerfile as an OSS contributor to resolve this error on Dify Cloud?
Version 0.7.0 has the same problem
I had the same problem. Any way to figure it out?
Get the same issue on api-0.7.1 and sandbox-0.2.6 @Yeuoly TOT
Get the same issue on api-0.7.1 and sandbox-0.2.6 @Yeuoly TOT
I suggest using httpx instead, it's a requests alternative solution and it works better.
Why this issue be closed, I have the same problem.