[Bug]: Connection refused error on WSL2
Describe the bug
Running WSL2 with Ubuntu. Installed autogenstudio via pip. Ran it with the standard autogenstudio ui --port 8081 command.
The web ui works fine, but when I try to chat, I get a connection refused with a lengthy error message.
Here is the error message:
jynx@TJ-Desktop:~$ autogenstudio ui --port 8081
INFO: Started server process [414]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8081 (Press CTRL+C to quit)
INFO: 127.0.0.1:43710 - "GET / HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43710 - "GET /images/svgs/welcome.svg HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43710 - "GET /app-0b19e7b3b3630760e904.js HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43710 - "GET /framework-0e118549f33203964972.js HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43710 - "GET /webpack-runtime-d26758facd302421ecb4.js HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43710 - "GET /page-data/app-data.json HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43710 - "GET /page-data/index/page-data.json HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43710 - "GET /favicon-32x32.png?v=46131b614287332146ea078703a67d38 HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43710 - "GET /318ce576f236b79fd96f75904c13f6e55c3eee57-8feabdf57edb2a6eecc8.js HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43710 - "GET /6c05b3ab656a8bfc225a64b3d73a36a92f83c05e-6dce912a9a9b963cded5.js HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43710 - "GET /component---src-pages-index-tsx-3209e5a7b17734fbd11c.js HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43764 - "GET /manifest.webmanifest HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43710 - "GET /api/[email protected] HTTP/1.1" 200 OK
INFO: 127.0.0.1:43710 - "GET /api/[email protected] HTTP/1.1" 200 OK
INFO: 127.0.0.1:43710 - "GET /api/[email protected]&session_id=2204c1e6-01fc-4ff5-a487-eb881ff1d18d HTTP/1.1" 200 OK
INFO: 127.0.0.1:43710 - "GET /api/[email protected]&session_id=2204c1e6-01fc-4ff5-a487-eb881ff1d18d HTTP/1.1" 200 OK
INFO: 127.0.0.1:43726 - "GET /page-data/gallery/page-data.json HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43742 - "GET /page-data/build/page-data.json HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43742 - "GET /page-data/gallery/page-data.json HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43726 - "GET /page-data/build/page-data.json HTTP/1.1" 304 Not Modified
userproxy (to primary_assistant):
i'm writing to you from autogen studio. can you give me an overview of what kiund of thigns i can use autogen for? what's a good starting project for it?
--------------------------------------------------------------------------------
userproxy (to primary_assistant):
test
--------------------------------------------------------------------------------
userproxy (to primary_assistant):
Write a python script to plot a sine wave and save it to disc as a png file sine_wave.png
--------------------------------------------------------------------------------
userproxy (to primary_assistant):
test
--------------------------------------------------------------------------------
Traceback (most recent call last):
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_backends/sync.py", line 206, in connect_tcp
sock = socket.create_connection(
File "/usr/lib/python3.10/socket.py", line 845, in create_connection
raise err
File "/usr/lib/python3.10/socket.py", line 833, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 67, in map_httpcore_exceptions
yield
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 231, in handle_request
resp = self._pool.handle_request(req)
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 268, in handle_request
raise exc
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 251, in handle_request
response = connection.handle_request(request)
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 99, in handle_request
raise exc
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 76, in handle_request
stream = self._connect(request)
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 124, in _connect
stream = self._network_backend.connect_tcp(**kwargs)
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_backends/sync.py", line 205, in connect_tcp
with map_exceptions(exc_map):
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/jynx/.local/lib/python3.10/site-packages/openai/_base_client.py", line 887, in _request
response = self._client.send(
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_client.py", line 915, in send
response = self._send_handling_auth(
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_client.py", line 943, in _send_handling_auth
response = self._send_handling_redirects(
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_client.py", line 980, in _send_handling_redirects
response = self._send_single_request(request)
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_client.py", line 1016, in _send_single_request
response = transport.handle_request(request)
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 230, in handle_request
with map_httpcore_exceptions():
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 84, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_backends/sync.py", line 206, in connect_tcp
sock = socket.create_connection(
File "/usr/lib/python3.10/socket.py", line 845, in create_connection
raise err
File "/usr/lib/python3.10/socket.py", line 833, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 67, in map_httpcore_exceptions
yield
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 231, in handle_request
resp = self._pool.handle_request(req)
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 268, in handle_request
raise exc
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 251, in handle_request
response = connection.handle_request(request)
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 99, in handle_request
raise exc
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 76, in handle_request
stream = self._connect(request)
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 124, in _connect
stream = self._network_backend.connect_tcp(**kwargs)
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_backends/sync.py", line 205, in connect_tcp
with map_exceptions(exc_map):
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/jynx/.local/lib/python3.10/site-packages/openai/_base_client.py", line 887, in _request
response = self._client.send(
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_client.py", line 915, in send
response = self._send_handling_auth(
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_client.py", line 943, in _send_handling_auth
response = self._send_handling_redirects(
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_client.py", line 980, in _send_handling_redirects
response = self._send_single_request(request)
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_client.py", line 1016, in _send_single_request
response = transport.handle_request(request)
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 230, in handle_request
with map_httpcore_exceptions():
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 84, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_backends/sync.py", line 206, in connect_tcp
sock = socket.create_connection(
File "/usr/lib/python3.10/socket.py", line 845, in create_connection
raise err
File "/usr/lib/python3.10/socket.py", line 833, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 67, in map_httpcore_exceptions
yield
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 231, in handle_request
resp = self._pool.handle_request(req)
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 268, in handle_request
raise exc
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_sync/connection_pool.py", line 251, in handle_request
response = connection.handle_request(request)
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 99, in handle_request
raise exc
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 76, in handle_request
stream = self._connect(request)
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 124, in _connect
stream = self._network_backend.connect_tcp(**kwargs)
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_backends/sync.py", line 205, in connect_tcp
with map_exceptions(exc_map):
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/home/jynx/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/jynx/.local/lib/python3.10/site-packages/openai/_base_client.py", line 887, in _request
response = self._client.send(
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_client.py", line 915, in send
response = self._send_handling_auth(
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_client.py", line 943, in _send_handling_auth
response = self._send_handling_redirects(
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_client.py", line 980, in _send_handling_redirects
response = self._send_single_request(request)
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_client.py", line 1016, in _send_single_request
response = transport.handle_request(request)
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 230, in handle_request
with map_httpcore_exceptions():
File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "/home/jynx/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 84, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/jynx/.local/lib/python3.10/site-packages/autogenstudio/web/app.py", line 68, in add_message
response_message: Message = chatmanager.chat(
File "/home/jynx/.local/lib/python3.10/site-packages/autogenstudio/chatmanager.py", line 29, in chat
flow.run(message=f"{message_text}", clear_history=False)
File "/home/jynx/.local/lib/python3.10/site-packages/autogenstudio/workflowmanager.py", line 191, in run
self.sender.initiate_chat(
File "/home/jynx/.local/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 621, in initiate_chat
self.send(self.generate_init_message(**context), recipient, silent=silent)
File "/home/jynx/.local/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 398, in send
recipient.receive(message, self, request_reply, silent)
File "/home/jynx/.local/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 551, in receive
reply = self.generate_reply(messages=self.chat_messages[sender], sender=sender)
File "/home/jynx/.local/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 1193, in generate_reply
final, reply = reply_func(self, messages=messages, sender=sender, config=reply_func_tuple["config"])
File "/home/jynx/.local/lib/python3.10/site-packages/autogen/agentchat/conversable_agent.py", line 708, in generate_oai_reply
response = client.create(
File "/home/jynx/.local/lib/python3.10/site-packages/autogen/oai/client.py", line 278, in create
response = self._completions_create(client, params)
File "/home/jynx/.local/lib/python3.10/site-packages/autogen/oai/client.py", line 543, in _completions_create
response = completions.create(**params)
File "/home/jynx/.local/lib/python3.10/site-packages/openai/_utils/_utils.py", line 271, in wrapper
return func(*args, **kwargs)
File "/home/jynx/.local/lib/python3.10/site-packages/openai/resources/chat/completions.py", line 643, in create
return self._post(
File "/home/jynx/.local/lib/python3.10/site-packages/openai/_base_client.py", line 1112, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
File "/home/jynx/.local/lib/python3.10/site-packages/openai/_base_client.py", line 859, in request
return self._request(
File "/home/jynx/.local/lib/python3.10/site-packages/openai/_base_client.py", line 911, in _request
return self._retry_request(
File "/home/jynx/.local/lib/python3.10/site-packages/openai/_base_client.py", line 982, in _retry_request
return self._request(
File "/home/jynx/.local/lib/python3.10/site-packages/openai/_base_client.py", line 911, in _request
return self._retry_request(
File "/home/jynx/.local/lib/python3.10/site-packages/openai/_base_client.py", line 982, in _retry_request
return self._request(
File "/home/jynx/.local/lib/python3.10/site-packages/openai/_base_client.py", line 921, in _request
raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.
INFO: 127.0.0.1:43710 - "POST /api/messages HTTP/1.1" 200 OK
INFO: 127.0.0.1:43726 - "GET /component---src-pages-gallery-index-tsx-f78f5f06ef65ea97e302.js HTTP/1.1" 304 Not Modified
INFO: 127.0.0.1:43742 - "GET /component---src-pages-build-tsx-10ec7cd0147b32ec3a0b.js HTTP/1.1" 304 Not Modified
Steps to reproduce
see above
Expected Behavior
not a connection refused error when trying to talk to the model
Screenshots and logs
No response
Additional Information
No response
Hi
What model are you using? You must also specify the model you intend to use in the workflow config UI (and remove all others)
using OpenAI GPT4. Is this the right configuration?
Under models … can you confirm you have an api key? Eg when you select gpt-4-1106-preview … can you ensure you have your api key setup there also.
It wasn't set there before (I set it via an environment variable before).
I added that and the model base url but the issue persists
Your key seems long. Is this Azure Open AI or OpenAI?
Note:
- For azure openai, you will need to fill in all the fields (see below)
- For openai you only need to provide model name and api key
For azure openai you will need to set the following
- model - which is the deployment id or engine
- api key .. from azure
- base url .. from azure
- model type .. - "azure"
- api version ... which must be what you get from azure.
Also note that you should only have this model in your list of models.
I'm having the same issue on WSL2 Ubuntu 22.04 under Windows 11.
In my case there weren't any models set for the userproxy agent, but they were set for primary_assistant.
I've added gpt-4-1106-preview to the userproxy agent, the same as it was set for primary_assistant.
I've also set my OPENAI_API_KEY envvar and added the API key to the models of both agents but still getting the connection error.
I'm intending to add OpenAI API keys, ie I'm not trying to add Azure models.
Is there anything useful I can send you to help you debug this?
Hmmm, I'm getting the same error using a native Windows install with Miniconda. WSL2 doesn't seem to be the culprit. Maybe there's something missing in the userproxy agent config?
Update: and in a new, totally unrelated MacOS Sonoma 14.2.1 install.
Update2: AutoGen agents manually configured in Python code do work.
Yes, I have an API key setup there, as well as an environment variable set. I've also put the base url in as https://api.openai.com/v1
I've tried with WSL2, Miniconda, as well as docker in a ubuntu 22.04 image and seem to be getting the same error. I am also on windows 11. I also tried it on another ubuntu 22.04 physical server I had. After digging a little bit I see the default model is gpt-4-1106-preview, when looking at my rate limits on my account I do not see that available. After some digging it appears that you had to have a certain amount of money spent using API keys when OpenAI released it. I'm not sure if that is the issue, I tried removing that model from the primary agent but still getting the OpenAI connection error. I saw the other default model was gpt-3.5-turbo-16k, I tried just setting the agent to use this as it appears I do have access to that model in my openai settings page. Is there a more in depth guide in setting it up than the blog post? I see the blog post mentions config and it seems to save that info but I don't see any hidden folder or anything from the directory I'm running it in, nor anything in the home directory like ~/.autogen or anything of that nature.
Getting same error here -- just running native Windows 10.
Can people on this error confirm my above suspicion by going to: https://platform.openai.com/playground?assistant=new
And check in the models drop down if you have gpt-4-1106-preview, that may rule out if that's the underlying issue
I believe I have configured correctly, I have active API key entered and I did check on my playground, I do have gpt-4-1106-preview available, still getting connection error as well. Wasn't able to set it up for a local model through text-generation-webui either. I am able to use autogen without studio UI
Can people on this error confirm my above suspicion by going to: https://platform.openai.com/playground?assistant=new
And check in the models drop down if you have
gpt-4-1106-preview, that may rule out if that's the underlying issue
Yes, gpt-4-1106-preview exists in the model drop down.
I'm seeing an error as well. As you can see it is letting me use the gpt-4-1106-preview agent on the OpenAI website. Also, when I modify my autogen agents to only use GPT-3.5 the error persists.
UPDATE: Even though I have credits available for my OpenAI account, creating and running an agent on the OpenAI website throws an error saying that I have reached my quota:
I'm pretty sure this is a bug on their end because I should have money available:
@vannestn thanks for confirming. I also tested this in the playground and got the same error even with gpt-3.5. I dug into it a little it and looked at my limits and some articles.
Looked like I was in the free tier usage. I bought $10 worth of credits to jump me to tier 1.
After that I was able to use the playground with that model:
I tried upgrading autogen ui via (pip install -U autogen), and creating a new API key and running the UI again but still getting the same connection error. I'm not sure if I should wait a little bit, like it takes a few minutes to propagate my tier upgrade, but at least I figured out the OpenAI issue now with the error. Maybe if I get some more time later I will test some more.
When I bought new credits with Open AI, their own playground UI wasn’t able to use the credits until a day later. Maybe it’s a fraud prevention measure. After a day had passed, the playground was able to run an agent for me. Haven’t run the Autogen program yet but I’ll let you know how it goes.
On Mon, Jan 22, 2024 at 9:25 AM Anthony Oliver @.***> wrote:
@vannestn https://github.com/vannestn thanks for confirming. I also tested this in the playground and got the same error even with gpt-3.5. I dug into it a little it and looked at my limits and some articles. image.png (view on web) https://github.com/microsoft/autogen/assets/492564/5b5c385a-7f5a-4b65-9584-305fca23fdc3
Looked like I was in the free tier usage. I bought $10 worth of credits to jump me to tier 1. image.png (view on web) https://github.com/microsoft/autogen/assets/492564/494fe718-bff4-42e7-9cc6-934e22e74ca1
After that I was able to use the playground with that model: image.png (view on web) https://github.com/microsoft/autogen/assets/492564/5920f22c-82aa-49d6-b46d-de6b514d6bb3
I tried upgrading autogen ui via (pip install -U autogen), and creating a new API key and running the UI again but still getting the same connection error. I'm not sure if I should wait a little bit, like it takes a few minutes to propagate my tier upgrade, but at least I figured out the OpenAI issue now with the error. Maybe if I get some more time later I will test some more.
— Reply to this email directly, view it on GitHub https://github.com/microsoft/autogen/issues/1272#issuecomment-1904469395, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFMAWCX7ALKMLAJICV5LHKTYP2OHJAVCNFSM6AAAAABB37QDMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBUGQ3DSMZZGU . You are receiving this because you were mentioned.Message ID: @.***>
