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

TypeError: AsyncConnectionPool.__init__(), new install bug, httpx==0.24.1 #13840

Closed
w-e-w opened this issue Nov 3, 2023 · 13 comments
Closed
Labels
announcement bug Report of a confirmed bug

Comments

@w-e-w
Copy link
Collaborator

w-e-w commented Nov 3, 2023

Update fix has been pushed to master

please update your webui version if you are affected


issue #13836

starting around 2 hours ago any new installation of webui will not be able to launch
if you see an error like this

TypeError: AsyncConnectionPool.__init__() got an unexpected keyword argument 'socket_options'

the issue is caused by an updates to an external dependency httpx
webui works version 0.24.1, but due to some external changes the package automatically installed by webui is 0.25.1

a fix PR has already been made and hopefully this issue will get resolved soon
but until then to those who are affected please follow the following steps to resolve the issue yourself


there's two method of resolving the issues for yourself

method 1 manually installing the correct version of httpx

the can be done by running a pip command in the webui's python environment

from the webui root the following commands
if using powershell on windwos

.\venv\Scripts\Activate.ps1
pip install httpx==0.24.1

if using cmd on windows

venv\Scripts\activate
pip install httpx==0.24.1

if using linux

source venv/bin/activate
pip install httpx==0.24.1

method 2: manually modify webui's requirements

and and let webui installed the correct version

this is for those who don't know how to run commands

open stable-diffusion-webui/requirements_versions.txt and add httpx==0.24.1 to bottom and launch webui it should now start successfully

the file should look like this

torchsde==0.2.6
transformers==4.30.2
httpx==0.24.1

after webui has launched successfully, remember to remove the modifications
otherwise you might have trouble updating webui in the future

you can either manually restore the modification (using ctrl +z and save)
or by running thes git command

git restore requirements_versions.txt

or

git reset --hard
@w-e-w w-e-w added bug Report of a confirmed bug announcement labels Nov 3, 2023
@w-e-w w-e-w pinned this issue Nov 3, 2023
@w-e-w w-e-w changed the title new installation of webui will not launch, httpx==0.24.1, TypeError: AsyncConnectionPool.__init__() TypeError: AsyncConnectionPool.__init__() new installation of webui will not launch, httpx==0.24.1 Nov 3, 2023
@w-e-w w-e-w changed the title TypeError: AsyncConnectionPool.__init__() new installation of webui will not launch, httpx==0.24.1 TypeError: AsyncConnectionPool.__init__(), new install won't launch, httpx==0.24.1 Nov 3, 2023
@w-e-w w-e-w changed the title TypeError: AsyncConnectionPool.__init__(), new install won't launch, httpx==0.24.1 TypeError: AsyncConnectionPool.__init__(), new install bug, httpx==0.24.1 Nov 3, 2023
@w-e-w w-e-w closed this as completed Nov 3, 2023
@zngpng
Copy link

zngpng commented Nov 3, 2023

谢谢你
image

@a5414530
Copy link

a5414530 commented Nov 3, 2023

THX!!!

@KevsterPersson
Copy link

Not fix on mine, it still got the same TypeError

@KevsterPersson
Copy link

Not fix on mine, it still got the same TypeError

Re-cloned from lshqqytiger/stable-diffusion-webui-directml
The fix (httpx==0.24.1) has been already added to requirements_versions.txt

However, same TypeError occurs

Some of the log:

Installing collected packages: mpmath, urllib3, typing-extensions, sympy, pillow, numpy, networkx, MarkupSafe, idna, filelock, charset-normalizer, certifi, requests, jinja2, torch, torchvision, torch-directml
Successfully installed MarkupSafe-2.1.3 certifi-2023.7.22 charset-normalizer-3.3.2 filelock-3.13.1 idna-3.4 jinja2-3.1.2 mpmath-1.3.0 networkx-3.2.1 numpy-1.26.1 pillow-10.1.0 requests-2.31.0 sympy-1.12 torch-2.0.0 torch-directml-0.2.0.dev230426 torchvision-0.15.1 typing-extensions-4.8.0 urllib3-2.0.7

Launching Web UI with arguments: --onnx --backend directml
Traceback (most recent call last):
File "C:\Users\Kevster\stable-diffusion-webui-directml\launch.py", line 48, in
main()
File "C:\Users\Kevster\stable-diffusion-webui-directml\launch.py", line 44, in main
start()
File "C:\Users\Kevster\stable-diffusion-webui-directml\modules\launch_utils.py", line 676, in start
import webui
File "C:\Users\Kevster\stable-diffusion-webui-directml\webui.py", line 13, in
initialize.imports()
File "C:\Users\Kevster\stable-diffusion-webui-directml\modules\initialize.py", line 21, in imports
import gradio # noqa: F401
File "C:\Users\Kevster\stable-diffusion-webui-directml\venv\lib\site-packages\gradio_init_.py", line 3, in
import gradio.components as components
File "C:\Users\Kevster\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\components_init_.py", line 1, in
from gradio.components.annotated_image import AnnotatedImage
File "C:\Users\Kevster\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\components\annotated_image.py", line 12, in
from gradio import utils
File "C:\Users\Kevster\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\utils.py", line 353, in
class AsyncRequest:
File "C:\Users\Kevster\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\utils.py", line 372, in AsyncRequest
client = httpx.AsyncClient()
File "C:\Users\Kevster\stable-diffusion-webui-directml\venv\lib\site-packages\httpx_client.py", line 1397, in init
self._transport = self._init_transport(
File "C:\Users\Kevster\stable-diffusion-webui-directml\venv\lib\site-packages\httpx_client.py", line 1445, in _init_transport
return AsyncHTTPTransport(
File "C:\Users\Kevster\stable-diffusion-webui-directml\venv\lib\site-packages\httpx_transports\default.py", line 275, in init
self._pool = httpcore.AsyncConnectionPool(
TypeError: AsyncConnectionPool.init() got an unexpected keyword argument 'socket_options'

@NuraddinQJ
Copy link

Colab user can do:

!source venv/bin/activate 
!pip install httpx==0.24.1

devraj added a commit to anomaly/gallagher that referenced this issue Nov 10, 2023
httpx v0.25.x is causing issues with reports of an __init__ method not
working as expected, I noticed that stable diffusion has the same issue
AUTOMATIC1111/stable-diffusion-webui#13840

downgrading to v0.24 to stabalise tests and upgrade when it works, also
falling back to py3.11
@w-e-w w-e-w unpinned this issue Nov 10, 2023
@DatGuyDami
Copy link

Unfortunately, I still get the following error:

Launching Web UI with arguments: --onnx --backend directml
Traceback (most recent call last):
File "C:\Windows\System32\stable-diffusion-webui-directml\launch.py", line 48, in
main()
File "C:\Windows\System32\stable-diffusion-webui-directml\launch.py", line 44, in main
start()
File "C:\Windows\System32\stable-diffusion-webui-directml\modules\launch_utils.py", line 676, in start
import webui
File "C:\Windows\System32\stable-diffusion-webui-directml\webui.py", line 13, in
initialize.imports()
File "C:\Windows\System32\stable-diffusion-webui-directml\modules\initialize.py", line 21, in imports
import gradio # noqa: F401
File "C:\Windows\System32\stable-diffusion-webui-directml\venv\lib\site-packages\gradio_init_.py", line 3, in
import gradio.components as components
File "C:\Windows\System32\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\components_init_.py", line 1, in
from gradio.components.annotated_image import AnnotatedImage
File "C:\Windows\System32\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\components\annotated_image.py", line 12, in
from gradio import utils
File "C:\Windows\System32\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\utils.py", line 353, in
class AsyncRequest:
File "C:\Windows\System32\stable-diffusion-webui-directml\venv\lib\site-packages\gradio\utils.py", line 372, in AsyncRequest
client = httpx.AsyncClient()
File "C:\Windows\System32\stable-diffusion-webui-directml\venv\lib\site-packages\httpx_client.py", line 1397, in init
self._transport = self._init_transport(
File "C:\Windows\System32\stable-diffusion-webui-directml\venv\lib\site-packages\httpx_client.py", line 1445, in _init_transport
return AsyncHTTPTransport(
File "C:\Windows\System32\stable-diffusion-webui-directml\venv\lib\site-packages\httpx_transports\default.py", line 275, in init
self._pool = httpcore.AsyncConnectionPool(
TypeError: AsyncConnectionPool.init() got an unexpected keyword argument 'socket_options'

@DatGuyDami
Copy link

I believe I solved it by using the same command listed above “venv\Scripts\activate
pip install httpx==0.24.1' which gave me an output of:

(venv) (base) C:\Windows\System32\stable-diffusion-webui-directml>pip install httpx==0.24.1
Collecting httpx==0.24.1
Downloading httpx-0.24.1-py3-none-any.whl (75 kB)
---------------------------------------- 75.4/75.4 kB 692.9 kB/s eta 0:00:00
Requirement already satisfied: idna in c:\windows\system32\stable-diffusion-webui-directml\venv\lib\site-packages (from httpx==0.24.1) (3.4)
Requirement already satisfied: httpcore<0.18.0,>=0.15.0 in c:\windows\system32\stable-diffusion-webui-directml\venv\lib\site-packages (from httpx==0.24.1) (0.15.0)
Requirement already satisfied: sniffio in c:\windows\system32\stable-diffusion-webui-directml\venv\lib\site-packages (from httpx==0.24.1) (1.3.0)
Requirement already satisfied: certifi in c:\windows\system32\stable-diffusion-webui-directml\venv\lib\site-packages (from httpx==0.24.1) (2023.7.22)
Requirement already satisfied: anyio==3.* in c:\windows\system32\stable-diffusion-webui-directml\venv\lib\site-packages (from httpcore<0.18.0,>=0.15.0->httpx==0.24.1) (3.7.1)
Requirement already satisfied: h11<0.13,>=0.11 in c:\windows\system32\stable-diffusion-webui-directml\venv\lib\site-packages (from httpcore<0.18.0,>=0.15.0->httpx==0.24.1) (0.12.0)
Requirement already satisfied: exceptiongroup in c:\windows\system32\stable-diffusion-webui-directml\venv\lib\site-packages (from anyio==3.*->httpcore<0.18.0,>=0.15.0->httpx==0.24.1) (1.1.3)
Installing collected packages: httpx
Attempting uninstall: httpx
Found existing installation: httpx 0.25.1
Uninstalling httpx-0.25.1:
Successfully uninstalled httpx-0.25.1
Successfully installed httpx-0.24.1 <--so this version is required.

@spacexyqc
Copy link

Thank you for letting me, an average and basic player, still feel the beauty of technology. Although I used venv\Scripts\activate, pip install httpx==0.24.1 in cmd, it couldn't find the path, so I used txt instead and I was able to launch it successfully, thank you very much

@w-e-w w-e-w mentioned this issue Nov 19, 2023
1 task
@nanodan
Copy link

nanodan commented Nov 24, 2023

I still get this error even with the correct httpx version. The current requirements file actually pins httpcore to the incorrect version. httpx pinned to 0.24.1 requires httpcore>=0.17.2. Pin both of those packages to the right versions in requirements_onnx and requirements_versions and the install will succeed.

@w-e-w
Copy link
Collaborator Author

w-e-w commented Nov 24, 2023

@nanodan what requirements_onnx?


ahh I see the directml fork https://github.com/lshqqytiger/stable-diffusion-webui-directml/blob/master/requirements_onnx.txt

you confusing the base webui with directML fork, if this is an issue you should open an issue at there page

@nanodan
Copy link

nanodan commented Nov 25, 2023

@w-e-w you're right my apologies, I had about 30 tabs open and commented in the wrong thread!

@yu2ni
Copy link

yu2ni commented Dec 1, 2023

@w-e-w you're right my apologies, I had about 30 tabs open and commented in the wrong thread!

I had the same issue with directML. after installing httpx==0.24.1 in cmd I went to C:\Users(username)\AppData\Local\Programs\Python\Python310\Lib\site-packages, copied the following four folders: httpcore, httpcore-0.17.3-dist-info, httpx, httpx-0.24.1dist-info. Then I went to C:(folder name)\stable-diffusion-webui-directml\venv\Lib\site-packages, and there should be four folders there named similarly but different versions. I deleted those and pasted in the new ones. After doing this, webui-user was working again. Sorry if this makes no sense I know nothing about computers, but I hope your issue gets resolved if it hasn't been already

@CornerYang
Copy link

thank you very much for solving my problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
announcement bug Report of a confirmed bug
Projects
None yet
Development

No branches or pull requests

10 participants