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]: AttributeError: module 'h11' has no attribute 'Event' #4833

Closed
1 task done
TkonstAL opened this issue Nov 18, 2022 · 32 comments
Closed
1 task done

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

TkonstAL opened this issue Nov 18, 2022 · 32 comments
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@TkonstAL
Copy link

Is there an existing issue for this?

  • 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 TkonstAL added the bug-report Report of a bug, yet to be confirmed label Nov 18, 2022
@ClashSAN
Copy link
Collaborator

link the colab

@skdursh
Copy link

skdursh commented Nov 19, 2022

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.

@Cyberes
Copy link
Contributor

Cyberes commented Nov 19, 2022

lmao this is why we have 1.2k issues

@swayam1998
Copy link

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

@Extraltodeus
Copy link
Contributor

Extraltodeus commented Nov 19, 2022

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.

@StHowling
Copy link

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

@TkonstAL
Copy link
Author

TkonstAL commented Nov 19, 2022

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

@nigh8w0lf
Copy link

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

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

@TkonstAL
Copy link
Author

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?

@nigh8w0lf
Copy link

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'

@TkonstAL
Copy link
Author

TkonstAL commented Nov 19, 2022

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 TkonstAL changed the title [Bug]: [Bug]: AttributeError: module 'h11' has no attribute 'Event' Nov 19, 2022
@nigh8w0lf
Copy link

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

@swayam1998
Copy link

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

@Gamiac69
Copy link

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

@pluieciel
Copy link

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

@lschlieder
Copy link

lschlieder commented Nov 23, 2022

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.

@ReflectionRip
Copy link

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

@Vega-KH
Copy link

Vega-KH commented Nov 25, 2022

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

@davadu
Copy link

davadu commented Nov 25, 2022

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

@hstercode
Copy link

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

@nbdeity
Copy link

nbdeity commented Nov 28, 2022

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!

@tiffany352
Copy link

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'.

@Gamiac69
Copy link

Gamiac69 commented Dec 6, 2022

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

@trickeyone
Copy link

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.

@Night-Chan
Copy link

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.

@RalphX1
Copy link

RalphX1 commented Dec 15, 2022

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

@dagf2101
Copy link

dagf2101 commented Dec 17, 2022

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....

@RanchMobile
Copy link

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

@chmielad
Copy link

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

AUTOMATIC1111 added a commit that referenced this issue Dec 24, 2022
Set httpcore version in requirements - fixes #4833
@bhaveshtolia
Copy link

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.

@sirmo
Copy link

sirmo commented May 11, 2023

Why not use requests like a normal person? Why use something (httpcore) at version 0.17.0 with ever changing API? I don't understand the choice of a module here.

@artkpv
Copy link

artkpv commented Jul 31, 2023

I had this with conda. I removed both from pip first: pip uninstall httpcore h11 . Then I installed both via conda: conda install -n <env name> httpcore h11. Seems to work for me.

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

No branches or pull requests