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

[Bug]: error when running webui.sh #13236

Closed
1 task done
dongyun-kim-arch opened this issue Sep 13, 2023 · 48 comments · Fixed by r2k-in-the-vortex/stable-diffusion-webui#1
Closed
1 task done

[Bug]: error when running webui.sh #13236

dongyun-kim-arch opened this issue Sep 13, 2023 · 48 comments · Fixed by r2k-in-the-vortex/stable-diffusion-webui#1
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@dongyun-kim-arch
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

Clone this repository (1.6) and it doesn't work.

Steps to reproduce the problem

  1. git clone sd-webui auto1111 recent repo (1.6)
  2. bash webui.sh
  3. error pops up

What should have happened?

The model should run...

Sysinfo

Ubuntu20.04

What browsers do you use to access the UI ?

No response

Console logs

Launching Web UI with arguments: 
Traceback (most recent call last):
  File "launch.py", line 48, in <module>
    main()
  File "launch.py", line 44, in main
    start()
  File "/home/causer/Desktop/seg/stable-diffusion-webui/modules/launch_utils.py", line 432, in start
    import webui
  File "/home/causer/Desktop/seg/stable-diffusion-webui/webui.py", line 13, in <module>
    initialize.imports()
  File "/home/causer/Desktop/seg/stable-diffusion-webui/modules/initialize.py", line 21, in imports
    import gradio  # noqa: F401
  File "/home/causer/Desktop/seg/stable-diffusion-webui/venv/lib/python3.8/site-packages/gradio/__init__.py", line 3, in <module>
    import gradio.components as components
  File "/home/causer/Desktop/seg/stable-diffusion-webui/venv/lib/python3.8/site-packages/gradio/components/__init__.py", line 1, in <module>
    from gradio.components.annotated_image import AnnotatedImage
  File "/home/causer/Desktop/seg/stable-diffusion-webui/venv/lib/python3.8/site-packages/gradio/components/annotated_image.py", line 12, in <module>
    from gradio import utils
  File "/home/causer/Desktop/seg/stable-diffusion-webui/venv/lib/python3.8/site-packages/gradio/utils.py", line 353, in <module>
    class AsyncRequest:
  File "/home/causer/Desktop/seg/stable-diffusion-webui/venv/lib/python3.8/site-packages/gradio/utils.py", line 372, in AsyncRequest
    client = httpx.AsyncClient()
  File "/home/causer/Desktop/seg/stable-diffusion-webui/venv/lib/python3.8/site-packages/httpx/_client.py", line 1397, in __init__
    self._transport = self._init_transport(
  File "/home/causer/Desktop/seg/stable-diffusion-webui/venv/lib/python3.8/site-packages/httpx/_client.py", line 1445, in _init_transport
    return AsyncHTTPTransport(
  File "/home/causer/Desktop/seg/stable-diffusion-webui/venv/lib/python3.8/site-packages/httpx/_transports/default.py", line 275, in __init__
    self._pool = httpcore.AsyncConnectionPool(
TypeError: __init__() got an unexpected keyword argument 'socket_options'

Additional information

No response

@dongyun-kim-arch dongyun-kim-arch added the bug-report Report of a bug, yet to be confirmed label Sep 13, 2023
@anonymoussss
Copy link

have the same question 😭

@dongyun-kim-arch
Copy link
Author

Resolved this issue by updating SD v1.6
It seems the issue is related to the version...
To use sd v1.6, python 3.10 is required.

@anonymoussss
Copy link

Thank you for your quick reply!
Do you mean to update python to 3.10?
I saw that you cloned the 1.6 repository before

@CrossNox
Copy link

I fixed it with

pip install -U pip
pip install -U httpcore

@anonymoussss
Copy link

Thanks for everyone so much, but all the modifications are not useful to me. 😭
I have tried SD version from 1.0.0 to 1.6.0, but still not work.
When using SD version greater than 1.3.1, report an error: "TypeError: init() got an unexpected keyword argument 'socket_options'" . When using SD version less than 1.3.1, an error "ImportError: cannot import name 'Undefined' from" will be reported. 'pydantic.fields' (/home/user/stable-diffusion-webui/venv/lib/python3.8/site-packages/pydantic/fields.py)".
I am running sdwebui in docker+python3.8. It seems that I need to change the operating environment.

@dongyun-kim-arch
Copy link
Author

Solution:

Create conda environment:
$ conda create -y -n stable-diffusion python=3.10

Edit the following line of webui-user.sh:
python_cmd="/home/USER_NAME/anaconda3/envs/stable-diffusion/bin/python3"

Run:
bash webui.sh

@dongyun-kim-arch dongyun-kim-arch changed the title [Bug]: [Bug]: error when running webui.sh Sep 14, 2023
@i-Showtime
Copy link

Solution that ended up working form me:
Delete VENV folder
regenerate with

python3.10 -m venv venv

#13054 might be related

@luyvlei
Copy link

luyvlei commented Sep 15, 2023

cd stable-diffusion-webui && source venv/bin/activate
pip3 install httpx==0.24.1

@ClashSAN
Copy link
Collaborator

The wiki for webui helps for showing installation on linux, apt install python3.10-venv and make a venv with python3.10 if your system version is different. https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Install-and-Run-on-NVidia-GPUs#linux

@anonymoussss
Copy link

cd stable-diffusion-webui && source venv/bin/activate
pip3 install httpx==0.24.1

It works for me! Thanks.

@MislavJuric
Copy link

I got this error when I tried doing the following:

  1. I followed the instructions on Automatic Installation on Linux
  2. I executed chmod +x webui.sh
  3. I executed bash webui.sh -f (I used this subsequently to try to run Stable Diffusion Web UI)

Then, I systematically tried all of the fixes suggested in this thread, but none of them worked:

I tried installing Python 3.10 by following this guide (Option 1), then adding an alias to my .bashrc file (alias python="/usr/bin/python3.10") so that the Python which gets executed when I execute python is actually Python 3.10. That didn't help with the error.

Then I activated the virtual environment by running source venv/bin/activate and I ran the following two commands:

  1. pip install -U pip
  2. pip install -U httpcore

After these commands, I got the following error. Here's the traceback:

(venv) root@C.7097089:~/stable-diffusion-webui$ bash webui.sh -f

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on root user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
python venv already activate or run without venv: /root/stable-diffusion-webui/venv
################################################################

################################################################
Launching launch.py...
################################################################
Cannot locate TCMalloc (improves CPU memory usage)
Python 3.8.10 (default, May 26 2023, 14:05:08) 
[GCC 9.4.0]
Version: v1.6.0
Commit hash: 5ef669de080814067961f28357256e8fe27544f4
Installing requirements
Launching Web UI with arguments: -f
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
Traceback (most recent call last):
  File "launch.py", line 48, in <module>
    main()
  File "launch.py", line 44, in main
    start()
  File "/root/stable-diffusion-webui/modules/launch_utils.py", line 432, in start
    import webui
  File "/root/stable-diffusion-webui/webui.py", line 13, in <module>
    initialize.imports()
  File "/root/stable-diffusion-webui/modules/initialize.py", line 33, in imports
    from modules import shared_init
  File "/root/stable-diffusion-webui/modules/shared_init.py", line 5, in <module>
    from modules import shared
  File "/root/stable-diffusion-webui/modules/shared.py", line 5, in <module>
    from modules import shared_cmd_options, shared_gradio_themes, options, shared_items, sd_models_types
  File "/root/stable-diffusion-webui/modules/options.py", line 74, in <module>
    class Options:
  File "/root/stable-diffusion-webui/modules/options.py", line 77, in Options
    def __init__(self, data_labels: dict[str, OptionInfo], restricted_opts):
TypeError: 'type' object is not subscriptable

I then tried pip3 install httpx==0.24.1 (still while inside the venv). It didn't fix the error above.

Since I got this error as a consequence of solving the original error in this thread, I am posting this here. I re-created this issue on multiple machines (I am using vast.ai).

Does someone have a fix for this?

@myInstagramAlternative
Copy link

#12884 (comment) This solved TypeError: 'type' object is not subscriptable.

I assume same I previously got this error also because of wrong py version.

Make sure you are on 3.10+

@victorbarlac
Copy link

cd stable-diffusion-webui && source venv/bin/activate
pip3 install httpx==0.24.1

It works for me! Thanks.

That worked for me, but I just needed that: pip3 install httpx==0.24.1

@Alex212192
Copy link

cd stable-diffusion-webui && source venv/bin/activate
pip3 install httpx==0.24.1

It works for me! Thanks.

That worked for me, but I just needed that: pip3 install httpx==0.24.1

hi, could you please explain where should i type those text?

@BenjaminIrwin
Copy link

cd stable-diffusion-webui && source venv/bin/activate
pip3 install httpx==0.24.1

It works for me! Thanks.

That worked for me, but I just needed that: pip3 install httpx==0.24.1

hi, could you please explain where should i type those text?

in terminal.

Also experiencing this bug for the first time today.

@infinitedarkw
Copy link

I have the same bug today. Anyone have advice how to solve it in Google Colab? TypeError: AsyncConnectionPool.__init__() got an unexpected keyword argument 'socket_options'

Ive tried some of the above but get syntax errors. Do I have to reinstall my entire Stable Diffusion/ Python environment?

I am a newbie, so treating me like the infant I am in explanations would be much appreciated.
Thanks!

smourph added a commit to smourph/stable-diffusion-webui-docker that referenced this issue Nov 3, 2023
Error:
  File "/home/causer/Desktop/seg/stable-diffusion-webui/venv/lib/python3.8/site-packages/httpx/_transports/default.py", line 275, in __init__
    self._pool = httpcore.AsyncConnectionPool(
TypeError: __init__() got an unexpected keyword argument 'socket_options'

See:
AUTOMATIC1111/stable-diffusion-webui#13836
AUTOMATIC1111/stable-diffusion-webui#13236 (comment)
@barbaram123
Copy link

Hello! I have a NVIDIA Quadro RTX 6000, and i have the same error message : " TypeError: AsyncConnectionPool.init() got an unexpected keyword argument 'socket_options' ". I tried the solutions mentioned above but it doesn't seem to work for me. If anyone have an other solution that would be great. Thanks

@poomshift
Copy link

in google colab add these 2 line work for me
!pip install httpx==0.24.0
!pip install gradio --upgrade

@barbaram123
Copy link

in google colab add these 2 line work for me !pip install httpx==0.24.0 !pip install gradio --upgrade

And when it's not on google Colab? Because for me i run it locally and i tried everything but it doesn't work

@KristianELewis
Copy link

Just had this issue. I installed it yesterday and it was working fine. I deleted venv and reinstalled today and it started giving me this error.

Can confirm this fixed it for me.

cd stable-diffusion-webui && source venv/bin/activate
pip3 install httpx==0.24.1

@shrimptuna2
Copy link

I'm getting this same error/problem with a fresh install of automatic1111 after installing python 3.10.6. None of the above has worked. Any ideas much appreciated.

@huntchar
Copy link

huntchar commented Nov 3, 2023

저는 이런 방법으로 해결 했다
/content/sd-webui/venv/lib/python3.10/site-packages/httpx/_transports/default.py

안에서 275번째 줄 self._pool = httpcore.AsyncConnectionPool
란 제일 아래에
socket_options=socket_option

이줄을 제거 하고 난뒤에 되었다

Line 275 in self._pool = httpcore.AsyncConnectionPool
at the bottom of the column
socket_options=socket_option

This happened after I removed this line:

@Frederik1997
Copy link

venv "E:\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: v1.6.0
Commit hash: 5ef669d
Launching Web UI with arguments:
Traceback (most recent call last):
File "E:\stable-diffusion-webui\launch.py", line 48, in
main()
File "E:\stable-diffusion-webui\launch.py", line 44, in main
start()
File "E:\stable-diffusion-webui\modules\launch_utils.py", line 432, in start
import webui
File "E:\stable-diffusion-webui\webui.py", line 13, in
initialize.imports()
File "E:\stable-diffusion-webui\modules\initialize.py", line 21, in imports
import gradio # noqa: F401
File "E:\stable-diffusion-webui\venv\lib\site-packages\gradio_init_.py", line 3, in
import gradio.components as components
File "E:\stable-diffusion-webui\venv\lib\site-packages\gradio\components_init_.py", line 1, in
from gradio.components.annotated_image import AnnotatedImage
File "E:\stable-diffusion-webui\venv\lib\site-packages\gradio\components\annotated_image.py", line 12, in
from gradio import utils
File "E:\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 353, in
class AsyncRequest:
File "E:\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 372, in AsyncRequest
client = httpx.AsyncClient()
File "E:\stable-diffusion-webui\venv\lib\site-packages\httpx_client.py", line 1397, in init
self._transport = self._init_transport(
File "E:\stable-diffusion-webui\venv\lib\site-packages\httpx_client.py", line 1445, in _init_transport
return AsyncHTTPTransport(
File "E:\stable-diffusion-webui\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'

Same problem. Anyone know how to solve it?

@huntchar
Copy link

huntchar commented Nov 3, 2023

E:\stable-diffusion-webui\venv\lib\site-packages\httpx_transports 로 가시면
default.py 이란 파일이 있는데
그 파이썬 파일 텍스트로 여시고

275번째 줄로가면
self._pool = httpcore.AsyncConnectionPool( 이란 내용이 있습니다.

거기에 제일 아랫줄에 가면
socket_options = socket_option
인가 이런 줄 있는데 이 부분 지우시고 실행하면 됩니다 전 이렇게 해결 했습니다.

@huntchar
Copy link

huntchar commented Nov 3, 2023

저는 이런 방법으로 해결했었습니다 /content/sd-webui/venv/lib/python3.10/site-packages/httpx/_transports/default.py
해야 275번째 줄 self._pool = httpcore.AsyncConnectionPool 란 제일 아래에 소켓_options=socket_option
이줄을 제거하고 난 뒤에 빠진
줄 275 in self._pool = httpcore.AsyncConnectionPool 열 맨 아래에 있는 소켓_options=socket_option
이 문제는 이 줄을 제거한 후에 발생했습니다.

죄송합니다. 조금 새로운 내용입니다. 정확히 무엇을 변경했는지 모르겠습니다. Line 275에 있는 내 파일은 다음과 같습니다.
self._pool = httpcore.asyncconnectionpool (ssl_context = ssl_context, max_connections = limits.max_connections, max_keepalive_connection = limits.max_keepalive_connection, requal_expory = limits.keepalive_expory, http1 = http1. , uds = uds, local_address = local_address, retries = retries, 소켓_옵션=소켓_옵션,

이것이 효과가 있었습니다! 매우 감사합니다!

Haha thank you

@r2k-in-the-vortex
Copy link

So you solved this issue ?

only manually, need to test a proper fix, I think it should be as simple as setting correct version in requirements_versions.txt but my python-fu is weak so I'm unsure

@Ydentity1
Copy link

E:\stable-diffusion-webui\venv\lib\site-packages\httpx_transports 로 가시면
default.py 이란 파일이 있는데
그 파이썬 파일 텍스트로 여시고

275번째 줄로가면
self._pool = httpcore.AsyncConnectionPool( 이란 내용이 있습니다.

거기에 제일 아랫줄에 가면
socket_options = socket_option
인가 이런 줄 있는데 이 부분 지우시고 실행하면 됩니다 전 이렇게 해결 했습니다.

이렇게 하니까 되네! 고마워

@huntchar
Copy link

huntchar commented Nov 3, 2023

E:\stable-diffusion-webui\venv\lib\site-packages\httpx_transports 로 가시면 default.py 이란 파일이 있는데 그 파이썬 파일 텍스트로 여시고

275번째 줄로가면 self._pool = httpcore.AsyncConnectionPool( 이란 내용이 있습니다.

거기에 제일 아랫줄에 가면 socket_options = socket_option 인가 이런 줄 있는데 이 부분 지우시고 실행하면 됩니다 전 이렇게 해결 했습니다.

이렇게 하니까 되네! 고마워

모얏! 내가 먼저 발견 했다구우!

@Frederik1997
Copy link

E:\stable-diffusion-webui\venv\lib\site-packages\httpx_transports 로 가시면 default.py 이란 파일이 있는데 그 파이썬 파일 텍스트로 여시고

275번째 줄로가면 self._pool = httpcore.AsyncConnectionPool( 이란 내용이 있습니다.

거기에 제일 아랫줄에 가면 socket_options = socket_option 인가 이런 줄 있는데 이 부분 지우시고 실행하면 됩니다 전 이렇게 해결 했습니다.

thank you very much!!

@r2k-in-the-vortex
Copy link

r2k-in-the-vortex commented Nov 3, 2023

yes, I think this fix works, who usually reviews and merges pull requests around here?

oh well, someone will get around to it I'm sure

@huntchar
Copy link

huntchar commented Nov 3, 2023

E:\stable-diffusion-webui\venv\lib\site-packages\httpx_transports 로시면 default.py 이란 파일이 엮인 파일 텍스트로 여시고

275번째 줄로가면 self._pool = httpcore.AsyncConnectionPool( 이란 내용이 있습니다.

저기에 제일줄에 페인트 소켓_options = 소켓_옵션 인가 이런 줄 이 부분 수리하고 실행하면 전 이렇게 처리했습니다.

E:\stable-diffusion-webui\venv\lib\site-packages\httpx_transports 로시면
default.py 이란 파일이 엮인 파일
텍스트로 여시고

275번째 줄로가면
self._pool = httpcore.AsyncConnectionPool( 이란 내용이 있습니다.

저기에 제일줄에
페인트 소켓_options = 소켓_옵션
인가 이런 줄 이 부분 수리하고 실행하면 전 이렇게 처리했습니다.

@huntchar
Copy link

huntchar commented Nov 3, 2023

예, 이 부분의 특징이 효과가 있다고 생각합니다. 일반적으로 여기에서 풀 요청을 검토하고 압축하는 사람은 누구입니까?

아야 뭐, 뭐야?

We will find a way. we always have.

@r2k-in-the-vortex
Copy link

ah, change already made, get latest should be problem solved

@claire2022chan
Copy link

I just solved the problem with the command above. !pip install httpx==0.24.1

@DuckersMcQuack
Copy link

cd stable-diffusion-webui && source venv/bin/activate
pip3 install httpx==0.24.1

For future messups, one can simply just add "httpx==0.24.1" to requirements.txt, right?

@roseyyy2022ai
Copy link

I'm trying to run it on CPU in huggingface and got the same error but changing it in the requirements results in a build error. Version httpcore==0.24.1 is unavailable from the list of versions 0.01-1.0.2

@exeshe4ki
Copy link

I am not a coding guy, but i've read this thread and tried to repeat the process from @huntchar

And it helps in my case.

Open file: \stable-diffusion-webui\venv\Lib\site-packages\httpx_transports\default.py
Search line 275.

Code looks like that:

self._pool = httpcore.AsyncConnectionPool(
                ssl_context=ssl_context,
                max_connections=limits.max_connections,
                max_keepalive_connections=limits.max_keepalive_connections,
                keepalive_expiry=limits.keepalive_expiry,
                http1=http1,
                http2=http2,
                uds=uds,
                local_address=local_address,
                retries=retries,
                socket_options=socket_options,

Remove last line, socket_options=socket_options, save the file.
Restart SD.

@Brandon4466
Copy link

For anybody that is experiencing this problem on Windows, open a CMD in your main SD web-ui folder, then run these two commands:

venv\Scripts\activate.bat
pip install httpx==0.24.1

@Sieboldianus
Copy link

Does not work for me:

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

lib/python3.10/site-packages/httpx/_transports/default.py", line 275, in init
self._pool = httpcore.AsyncConnectionPool(
TypeError: AsyncConnectionPool.init() got an unexpected keyword argument 'socket_options'

@mewlolmelo
Copy link

I fixed it with

pip install -U pip
pip install -U httpcore

where am i uspposed to type this?

smourph added a commit to smourph/stable-diffusion-webui-docker that referenced this issue Dec 5, 2023
Error:
  File "/home/causer/Desktop/seg/stable-diffusion-webui/venv/lib/python3.8/site-packages/httpx/_transports/default.py", line 275, in __init__
    self._pool = httpcore.AsyncConnectionPool(
TypeError: __init__() got an unexpected keyword argument 'socket_options'

See:
AUTOMATIC1111/stable-diffusion-webui#13836
AUTOMATIC1111/stable-diffusion-webui#13236 (comment)
smourph added a commit to smourph/stable-diffusion-webui-docker that referenced this issue Dec 5, 2023
Error:
  File "/home/causer/Desktop/seg/stable-diffusion-webui/venv/lib/python3.8/site-packages/httpx/_transports/default.py", line 275, in __init__
    self._pool = httpcore.AsyncConnectionPool(
TypeError: __init__() got an unexpected keyword argument 'socket_options'

See:
AUTOMATIC1111/stable-diffusion-webui#13836
AUTOMATIC1111/stable-diffusion-webui#13236 (comment)
smourph added a commit to smourph/stable-diffusion-webui-docker that referenced this issue Dec 14, 2023
Error:
  File "/home/causer/Desktop/seg/stable-diffusion-webui/venv/lib/python3.8/site-packages/httpx/_transports/default.py", line 275, in __init__
    self._pool = httpcore.AsyncConnectionPool(
TypeError: __init__() got an unexpected keyword argument 'socket_options'

See:
AUTOMATIC1111/stable-diffusion-webui#13836
AUTOMATIC1111/stable-diffusion-webui#13236 (comment)
@matiasstornini
Copy link

no funciona ni una solucion, bravo, inservible

@matiasstornini
Copy link

la unica manera de arraglar esto es seleccionar la carpetira y SUPRIMIR; listo, se acabó el problema, cortar el sida este que no funciona 😎

@djbritt
Copy link

djbritt commented Apr 8, 2024

pip3 install httpx==0.24.1

This fixed sd web for me. With the issue "TypeError: AsyncConnectionPool.init() got an unexpected keyword argument 'socket_options'"

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

Successfully merging a pull request may close this issue.