OpenBMB / XAgent

An Autonomous LLM Agent for Complex Task Solving
https://blog.x-agent.net/blog/xagent/
Apache License 2.0
7.82k stars 795 forks source link

ToolServerNode 如何安装pip install httpx[http2] #337

Closed xxll88 closed 6 months ago

xxll88 commented 6 months ago

docker compose up : File "/usr/local/lib/python3.10/site-packages/httpx/_client.py", line 1389, in init xagent-ToolServerNode-1 | raise ImportError( xagent-ToolServerNode-1 | ImportError: Using http2=True, but the 'h2' package is not installed. Make sure to install httpx using pip install httpx[http2]. xagent-ToolServerNode-1 | xagent-ToolServerNode-1 | ERROR: Application startup failed. Exiting.

sudo docker exec XAgent-Server pip install httpx[http2] 可以安装,但无效

Umpire2018 commented 6 months ago

That's weird. Because you are pulling image from docker hub when you uses docker compose up. It doesn't require install dependency manually. Can you provide detailed log when using docker compose up or anything that can help use reproduce this issue.

liruixue commented 6 months ago

I met the same issue, the code version is 1.00, and I execute docker command 'docker compose build' first , and then use 'docker compose up', and this issue will come up. Also I found a way to work around:

# switch to \XAgent-1.0.0\dockerfiles\ToolServerNode\ directory
# modify 'Dockerfile' file
# find the row 'RUN pip install playwright && playwright install chromium &&  playwright install-deps', and insert the following row
RUN pip install httpx[http2]
# Notes:after finish above action, to run 'docker compose build'  'docker compose up' again
Umpire2018 commented 6 months ago

@liruixue Can you try to use lastest code?

liruixue commented 6 months ago

Sure, I will try it when I have free time.

liruixue commented 6 months ago

@liruixue Can you try to use lastest code?

I tried the latest main code, it works fine, no need any further changes on 'Dokcerfile' file.

Starfruit007 commented 6 months ago

I have encountered the same issue and solved it. Here are the details:

Solution:

  1. add httpx[http2] into the file: XAgent/ToolServer/ToolServerNode/requirements.txt
  2. build the images locally with command docker-compose build

Why?
This issue happens when you build docker images locally with command docker-compose build and it seems the requirements in local file missing the package httpx[http2].

Besides, I also tried docker-compose up remotely (download the latest online images.), it works fine.

Umpire2018 commented 6 months ago

@Starfruit007 We have confirmed this issue and waiting for someone to open a pull request. :)