stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: AttributeError: module 'h11' has no attribute 'Event'

Open TkonstAL opened this issue 2 years ago • 25 comments

Is there an existing issue for this?

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

What happened?

No run colub

Steps to reproduce the problem

  1. Go to ....
  2. Press ....
  3. ...

What should have happened?

File "launch.py", line 256, in start() File "launch.py", line 247, in start import webui File "/content/stable-diffusion-webui/webui.py", line 13, in from modules import devices, sd_samplers, upscaler, extensions, localization File "/content/stable-diffusion-webui/modules/sd_samplers.py", line 11, in from modules import prompt_parser, devices, processing, images File "/content/stable-diffusion-webui/modules/processing.py", line 14, in import modules.sd_hijack File "/content/stable-diffusion-webui/modules/sd_hijack.py", line 10, in import modules.textual_inversion.textual_inversion File "/content/stable-diffusion-webui/modules/textual_inversion/textual_inversion.py", line 13, in from modules import shared, devices, sd_hijack, processing, sd_models, images File "/content/stable-diffusion-webui/modules/shared.py", line 8, in import gradio as gr File "/usr/local/lib/python3.8/site-packages/gradio/init.py", line 3, in import gradio.components as components File "/usr/local/lib/python3.8/site-packages/gradio/components.py", line 31, in from gradio import media_data, processing_utils, utils File "/usr/local/lib/python3.8/site-packages/gradio/processing_utils.py", line 20, in from gradio import encryptor, utils File "/usr/local/lib/python3.8/site-packages/gradio/utils.py", line 35, in import httpx File "/usr/local/lib/python3.8/site-packages/httpx/init.py", line 2, in from ._api import delete, get, head, options, patch, post, put, request, stream File "/usr/local/lib/python3.8/site-packages/httpx/_api.py", line 4, in from ._client import Client File "/usr/local/lib/python3.8/site-packages/httpx/_client.py", line 29, in from ._transports.default import AsyncHTTPTransport, HTTPTransport File "/usr/local/lib/python3.8/site-packages/httpx/_transports/default.py", line 30, in import httpcore File "/usr/local/lib/python3.8/site-packages/httpcore/init.py", line 1, in from ._api import request, stream File "/usr/local/lib/python3.8/site-packages/httpcore/_api.py", line 5, in from ._sync.connection_pool import ConnectionPool File "/usr/local/lib/python3.8/site-packages/httpcore/_sync/init.py", line 1, in from .connection import HTTPConnection File "/usr/local/lib/python3.8/site-packages/httpcore/_sync/connection.py", line 13, in from .http11 import HTTP11Connection File "/usr/local/lib/python3.8/site-packages/httpcore/_sync/http11.py", line 44, in class HTTP11Connection(ConnectionInterface): File "/usr/local/lib/python3.8/site-packages/httpcore/_sync/http11.py", line 140, in HTTP11Connection self, event: h11.Event, timeout: Optional[float] = None AttributeError: module 'h11' has no attribute 'Event'

Commit where the problem happens

StableDiffusionUI

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

No response

Additional information, context and logs

No response

TkonstAL avatar Nov 18 '22 22:11 TkonstAL

link the colab

ClashSAN avatar Nov 18 '22 23:11 ClashSAN

Need more info, but in any case you need to be running Python 3.10.x. The recommended build is 3.10.6. Several dependencies won't work with other major release versions of Python.

skdursh avatar Nov 19 '22 03:11 skdursh

lmao this is why we have 1.2k issues

Cyberes avatar Nov 19 '22 06:11 Cyberes

Yes. I am facing the same issue. It used to work perfectly before but this issue crawled up suddenly.

swayam1998 avatar Nov 19 '22 13:11 swayam1998

pip install --force-reinstall httpcore==0.15 works as a temporary workaround until some other fix is found. That or just append it to your requirement.txt This comes from a recent update in httpcore and nothing related to this repository.

Extraltodeus avatar Nov 19 '22 14:11 Extraltodeus

pip install --force-reinstall httpcore==0.15 works as a temporary workaround until some other fix is found. That or just append it to your requirement.txt This comes from a recent update in httpcore and nothing related to this repository.

lmao this is why we have 1.2k issues

for real the dude didn't even title the issue

thanks, that just fix this problem for me

StHowling avatar Nov 19 '22 14:11 StHowling

pip install --force-reinstall httpcore==0.15 it's just on a computer, but how to register in a colab? https://colab.research.google.com/drive/1wriLAuWlY1xlfq_Zpq0Fk5WgFTRFyyOG?usp=sharing

TkonstAL avatar Nov 19 '22 14:11 TkonstAL

@TkonstAL add a new code cell in colab and then run

!pip install --force-reinstall httpcore==0.15

nigh8w0lf avatar Nov 19 '22 15:11 nigh8w0lf

I also want to know how I can add this to the colab. https://huggingface.co/Gustavosta/MagicPrompt-Stable-Diffusion/tree/main Is it possible? I add - it used to work and now it doesn't?

TkonstAL avatar Nov 19 '22 15:11 TkonstAL

just manually install for now whenever you need to use it, hopefully this will be fixed soon and you don't have to do anything.

also @TkonstAL can you please update the title of this bug report from [Bug]: #4833 to the below title please. AttributeError: module 'h11' has no attribute 'Event'

nigh8w0lf avatar Nov 19 '22 15:11 nigh8w0lf

I don't really know how to edit here. Where should I unpack it? https://www.reddit.com/r/StableDiffusion/comments/xvjm84/magicprompt_script_for_automatic1111_gui_let_the/ I read it but didn't fully understand. P.S i find this !pip install git+https://github.com/KichangKim/DeepDanbooru.git@edf73df4cdaeea2cf00e9ac08bd8a9026b7a7b26 but is non magicpromt

TkonstAL avatar Nov 19 '22 15:11 TkonstAL

in your colab notebook https://www.reddit.com/r/StableDiffusion/comments/xvjm84/magicprompt_script_for_automatic1111_gui_let_the/ when you get the AttributeError: module 'h11' has no attribute 'Event', scroll up and add a new cell by clicking the + code button image the copy paste the below command and run the cell !pip install --force-reinstall httpcore==0.15

nigh8w0lf avatar Nov 19 '22 15:11 nigh8w0lf

pip install --force-reinstall httpcore==0.15 works as a temporary workaround until some other fix is found. That or just append it to your requirement.txt This comes from a recent update in httpcore and nothing related to this repository.

lmao this is why we have 1.2k issues

for real the dude didn't even title the issue

Does not work for me still. I had to update python 3.8 to 3.10 to fix this issue. But its a hassle to update python. I thought that updating httpcore should work but it didn't

swayam1998 avatar Nov 20 '22 16:11 swayam1998

Guys both reinstalling httpcore and python doesn't work for me and I still get the same error

Gamiac69 avatar Nov 20 '22 21:11 Gamiac69

I tried to force reinstall httpcore, it worked last week, but no more now. try to replace the http11.py in "../'env'(or usr/local/) /lib/python3.8/site-packages/httpcore/_async/" or _sync corresponding to the ERROR by the files from below: (better to backup the original file first) httpcore.zip

pluieciel avatar Nov 22 '22 23:11 pluieciel

Guys both reinstalling httpcore and python doesn't work for me and I still get the same error

Have you run it with the environment activated? if not, run source venv/bin/activate before reinstalling.

lschlieder avatar Nov 23 '22 22:11 lschlieder

Just wanted to note I saw this today. The above recommendations worked: cd stable-diffusion-webui source venv/bin/activate pip install --force-reinstall httpcore==0.15

ReflectionRip avatar Nov 24 '22 15:11 ReflectionRip

I am using Python 3.8 which seems to be the root of the problem. But if I update to Python 3.10, I get a whole problem that Torch cannot use my graphics card.

Is there any way to resolve this without upgrading to 3.10?

I tried: pip install --force-reinstall httpcore==0.15

And I also tried using the files linked above by @pluieciel ... still getting the exact same error, h11 has no attribute Event

Vega-KH avatar Nov 25 '22 18:11 Vega-KH

cd stable-diffusion-webui source venv/Scripts/activate pip install --force-reinstall httpcore==0.15

also as am testing it on a pretty low spec laptop on file webui-user added: set COMMANDLINE_ARGS=--lowvram --precision full --no-half --skip-torch-cuda-test

davadu avatar Nov 25 '22 19:11 davadu

Just adding that I had to run the python.exe that was in the venv directory directly to get 2.0 to run on Windows 10 stable-diffusion-webui\venv\scripts\python.exe -m pip install --force-reinstall httpcore==0.15

hstercode avatar Nov 27 '22 02:11 hstercode

EDIT:

Just adding that I had to run the python.exe that was in the venv directory directly to get 2.0 to run on Windows 10 stable-diffusion-webui\venv\scripts\python.exe -m pip install --force-reinstall httpcore==0.15

This worked!!!! THANK YOU!

nbdeity avatar Nov 28 '22 23:11 nbdeity

Need more info, but in any case you need to be running Python 3.10.x. The recommended build is 3.10.6. Several dependencies won't work with other major release versions of Python.

I just ran into this same issue because the pre-existing Python install on my PC was 3.9. I installed 3.10.8, it's working now.

Maybe the startup scripts could check that the python version is correct before running venv? Since Expected Python 3.10.x, got 3.9 would be a lot more informative than AttributeError: module 'h11' has no attribute 'Event'.

tiffany352 avatar Dec 04 '22 07:12 tiffany352

I uninstalled python on chocolatey to install the correct version and now when i reinstall it doesnt work. Can anyone help?

Gamiac69 avatar Dec 06 '22 20:12 Gamiac69

Preface: I'm running on Windows 10

I was having the same issues. I finally got it to launch. I had installed Python 3.10, but apparently it installed for only my user. So when I launched, it used the system's Python 3.9.1 version. I uninstalled 3.10, then reinstalled for all users. But I was still getting the error. So, after seeing others in this thread talk about the Python.exe in the venv directory, I decided to nuke the whole venv directory. After that, I relaunched and, after having to sit through all the other installing again, I finally got past the Web UI portion. Then after about 10 minutes of it downloading other requirements, I got to the loading weights and the message saying it was ready.

It appears that, even after installing Python 3.10 globally, for some reason it was still using a copy (?) of Python 3.9 in the venv directory.

trickeyone avatar Dec 11 '22 08:12 trickeyone

Preface: I'm running on Windows 10

I was having the same issues. I finally got it to launch. I had installed Python 3.10, but apparently it installed for only my user. So when I launched, it used the system's Python 3.9.1 version. I uninstalled 3.10, then reinstalled for all users. But I was still getting the error. So, after seeing others in this thread talk about the Python.exe in the venv directory, I decided to nuke the whole venv directory. After that, I relaunched and, after having to sit through all the other installing again, I finally got past the Web UI portion. Then after about 10 minutes of it downloading other requirements, I got to the loading weights and the message saying it was ready.

It appears that, even after installing Python 3.10 globally, for some reason it was still using a copy (?) of Python 3.9 in the venv directory.

This works! But what you really want to do is change the value in \venv\pyvenv.cfg to 310. That does the same thing, because nuking the whole folder for some reason used the old python version. This is how I fixed it.

Night-Chan avatar Dec 12 '22 19:12 Night-Chan

Just wanted to note I saw this today. The above recommendations worked: cd stable-diffusion-webui source venv/bin/activate pip install --force-reinstall httpcore==0.15

For windows(using cmd.exe):

cd stable-diffusion-webui venv\Scripts\activate.bat pip install --force-reinstall httpcore==0.15

RalphX1 avatar Dec 15 '22 12:12 RalphX1

After trying with ubuntu 18 and 20, switched to ubuntu22.0.4 (WSL2) which come by default now with python3.10.6

Also had to install some missing stuff, here is the full list. sudo apt install python3-venv sudo apt install libgl1-mesa-dev sudo apt install build-essential source venv/bin/activate pip install xformers==0.0.12 pip install triton

./webui.sh --xformers

EDIT: The previous setup does not work for xformers... the fact is that xformers in WSL simply does not worth the investment. I surrender and resetup myself in plain windows....

dagf2101 avatar Dec 17 '22 17:12 dagf2101

If you are in WINDOWS environment make sure you are running your command prompt in elevated privilege "Run as administrator".

RanchMobile avatar Dec 20 '22 13:12 RanchMobile

Hi,

The same issue, i try to instal httpcore==0.15 but problem still exist.

... File "/usr/lib/python3.10/site-packages/httpcore/_sync/init.py", line 1, in module from .connection import HTTPConnection File "/usr/lib/python3.10/site-packages/httpcore/_sync/connection.py", line 13, in module from .http11 import HTTP11Connection File "/usr/lib/python3.10/site-packages/httpcore/_sync/http11.py", line 44, in module class HTTP11Connection(ConnectionInterface): File "/usr/lib/python3.10/site-packages/httpcore/_sync/http11.py", line 140, in HTTP11Connection self, event: h11.Event, timeout: Optional[float] = None AttributeError: module 'h11' has no attribute 'Event'

>pip list | grep "http" aiohttp 3.8.1 aiohttp-cors 0.7.0 httpcore 0.15.0 httpx 0.23.1

chmielad avatar Dec 23 '22 08:12 chmielad

I uninstalled all h11 and httpcore packages. Reinstalled just h11's latest version and it worked. All the other steps mentioned above didn't work for me.

bhaveshtolia avatar Jan 25 '23 12:01 bhaveshtolia