stable-diffusion-webui
stable-diffusion-webui copied to clipboard
[Bug]: socksio package requirement on MacOS with M1 Max chip
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What happened?
I tried to deploy the web-ui with the instruction and got an error as following:
ImportError: Using SOCKS proxy, but the 'socksio' package is not installed. Make sure to install httpx using `pip install httpx[socks]`.
It seems that some packages are missing, so I edit the ./web-ui.sh
and add a line as following:
pip install socksio
Then, the web-UI works well.
Actually, the web-ui is running in a python virtual env, I think maybe it's not correct that some packages are missing. I'm not sure should we add the socksio package to requirement list.
Steps to reproduce the problem
Following the Apple Silicon instruction.
What should have happened?
Got an error the socksio is missing
Commit where the problem happens
0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8
What platforms do you use to access the UI ?
MacOS
What browsers do you use to access the UI ?
Google Chrome
Command Line Arguments
No
List of extensions
No
Console logs
❯ ./webui.sh
################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################
################################################################
Running on jiajinghu user
################################################################
webui.sh+ buffers
################################################################
Repo already cloned, using it as install directory
################################################################
################################################################
Create and activate python venv
################################################################
################################################################
Launching launch.py...
################################################################
Python 3.10.8 (main, Oct 21 2022, 22:22:30) [Clang 14.0.0 (clang-1400.0.29.202)]
Commit hash: 0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8
Installing clip
Installing open_clip
Cloning Stable Diffusion into repositories/stable-diffusion-stability-ai...
Cloning Taming Transformers into repositories/taming-transformers...
Cloning K-diffusion into repositories/k-diffusion...
Cloning CodeFormer into repositories/CodeFormer...
Cloning BLIP into repositories/BLIP...
Installing requirements for CodeFormer
Installing requirements for Web UI
Launching Web UI with arguments: --upcast-sampling --no-half-vae --use-cpu interrogate
Traceback (most recent call last):
File "/Users/jiajinghu/Code/novelai/stable-diffusion-webui/launch.py", line 361, in <module>
start()
File "/Users/jiajinghu/Code/novelai/stable-diffusion-webui/launch.py", line 352, in start
import webui
File "/Users/jiajinghu/Code/novelai/stable-diffusion-webui/webui.py", line 15, in <module>
from modules import import_hook, errors, extra_networks, ui_extra_networks_checkpoints
File "/Users/jiajinghu/Code/novelai/stable-diffusion-webui/modules/ui_extra_networks_checkpoints.py", line 6, in <module>
from modules import shared, ui_extra_networks, sd_models
File "/Users/jiajinghu/Code/novelai/stable-diffusion-webui/modules/shared.py", line 9, in <module>
import gradio as gr
File "/Users/jiajinghu/Code/novelai/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/__init__.py", line 3, in <module>
import gradio.components as components
File "/Users/jiajinghu/Code/novelai/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/components.py", line 34, in <module>
from gradio import media_data, processing_utils, utils
File "/Users/jiajinghu/Code/novelai/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/processing_utils.py", line 23, in <module>
from gradio import encryptor, utils
File "/Users/jiajinghu/Code/novelai/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 416, in <module>
class AsyncRequest:
File "/Users/jiajinghu/Code/novelai/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 436, in AsyncRequest
client = httpx.AsyncClient()
File "/Users/jiajinghu/Code/novelai/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_client.py", line 1411, in __init__
self._mounts: typing.Dict[URLPattern, typing.Optional[AsyncBaseTransport]] = {
File "/Users/jiajinghu/Code/novelai/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_client.py", line 1414, in <dictcomp>
else self._init_proxy_transport(
File "/Users/jiajinghu/Code/novelai/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_client.py", line 1467, in _init_proxy_transport
return AsyncHTTPTransport(
File "/Users/jiajinghu/Code/novelai/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 296, in __init__
raise ImportError(
ImportError: Using SOCKS proxy, but the 'socksio' package is not installed. Make sure to install httpx using `pip install httpx[socks]`.
Additional information
No response
Try turning off the command line proxy
ths,bro.
it works
@gafish Thanks, it works now.
add to where ? is webui.sh file?
add to where ? is webui.sh file?
@iScript Yes, just add it to webui.sh
I add like this
Try turning off the command line proxy
I have the same issue, but the way did not work for me. I use M1 Pro 2021, and I am in China with Great Firewall. Usually I will Use v2ray. Here are the things i did.
1️⃣The method @gafish provides "turn off the command line proxy". It did not work.❌
I edited it in the Terminal with the code
unset http_proxy unset https_proxy
I also had try turn off the v2ray App.
2️⃣ The method @hjiajing provides "add code 'pip install socksio'". It did not work.❌
Otherwise, I had install httpx[socks] and socksio in the Python3.10.6 path.
So what should I do now?
lzh@LZHdeMacBook-Pro stable-diffusion-webui % ./webui.sh
################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################
################################################################
Running on lzh user
################################################################
################################################################
Repo already cloned, using it as install directory
################################################################
################################################################
Create and activate python venv
################################################################
################################################################
Launching launch.py...
################################################################
Python 3.10.6 (v3.10.6:9c7b4bd164, Aug 1 2022, 17:13:48) [Clang 13.0.0 (clang-1300.0.29.30)]
Commit hash: a9fed7c364061ae6efb37f797b6b522cb3cf7aa2
Installing requirements for Web UI
Launching Web UI with arguments: --upcast-sampling --no-half-vae --use-cpu interrogate
Traceback (most recent call last):
File "/Users/lzh/Documents/AI/stable-diffusion-webui/launch.py", line 381, in <module>
start()
File "/Users/lzh/Documents/AI/stable-diffusion-webui/launch.py", line 372, in start
import webui
File "/Users/lzh/Documents/AI/stable-diffusion-webui/webui.py", line 22, in <module>
import gradio
File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/__init__.py", line 3, in <module>
import gradio.components as components
File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/components.py", line 34, in <module>
from gradio import media_data, processing_utils, utils
File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/processing_utils.py", line 23, in <module>
from gradio import encryptor, utils
File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 416, in <module>
class AsyncRequest:
File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 436, in AsyncRequest
client = httpx.AsyncClient()
File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_client.py", line 1411, in __init__
self._mounts: typing.Dict[URLPattern, typing.Optional[AsyncBaseTransport]] = {
File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_client.py", line 1414, in <dictcomp>
else self._init_proxy_transport(
File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_client.py", line 1467, in _init_proxy_transport
return AsyncHTTPTransport(
File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 296, in __init__
raise ImportError(
ImportError: Using SOCKS proxy, but the 'socksio' package is not installed. Make sure to install httpx using `pip install httpx[socks]`.
✅ Finally I had found why it does not work well. Here is my steps:
1️⃣ Reinstall Python. Uninstall the python3.10.6 which installed manually, and then use the Homebrew to install python(this is the step followed the webui instruction). There are some error after installing but it seems that we don't need to handle.
2️⃣ Download Requirements by global Terminal proxy. run ./webui.sh
, and then there will be some error about downloading and I set the Terminal Proxy by using
export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;export ALL_PROXY=socks5://127.0.0.1:1080
Then download is good until the error code of socks proxy shows again. The proxy code is copide from App v2rayNG.
3️⃣ Clear Proxy. I close the Terminal to clear the global Terminal proxy, and set the App v2rayNG to PAC mode. Then I run ./webui.sh
, it works well!
*️⃣ Conclusion: The problem of socks proxy due to the App v2rayNG. I turn off Terminal proxy by reopen it, then turn off v2rayNG global mode and set the PAC mode.
On M1 Macbook air, change to use Clash as proxy then add 'pip install socksio' in webui.sh works for me.
I add like this
ths bro, it helps me!
Thanks, bro
I add like this
ths bro, it helps me!
wuhu~ it works. thanks bro.
I add like this
ths bro, it helps me!
it works. thanks bro.
Good bro, it works.
I add like this
Try turning off the command line proxy
I have the same issue, but the way did not work for me. I use M1 Pro 2021, and I am in China with Great Firewall. Usually I will Use v2ray. Here are the things i did.
1️⃣The method @gafish provides "turn off the command line proxy". It did not work.❌ I edited it in the Terminal with the code
unset http_proxy unset https_proxy
I also had try turn off the v2ray App.
2️⃣ The method @hjiajing provides "add code 'pip install socksio'". It did not work.❌
Otherwise, I had install httpx[socks] and socksio in the Python3.10.6 path.
So what should I do now?
lzh@LZHdeMacBook-Pro stable-diffusion-webui % ./webui.sh ################################################################ Install script for stable-diffusion + Web UI Tested on Debian 11 (Bullseye) ################################################################ ################################################################ Running on lzh user ################################################################ ################################################################ Repo already cloned, using it as install directory ################################################################ ################################################################ Create and activate python venv ################################################################ ################################################################ Launching launch.py... ################################################################ Python 3.10.6 (v3.10.6:9c7b4bd164, Aug 1 2022, 17:13:48) [Clang 13.0.0 (clang-1300.0.29.30)] Commit hash: a9fed7c364061ae6efb37f797b6b522cb3cf7aa2 Installing requirements for Web UI Launching Web UI with arguments: --upcast-sampling --no-half-vae --use-cpu interrogate Traceback (most recent call last): File "/Users/lzh/Documents/AI/stable-diffusion-webui/launch.py", line 381, in <module> start() File "/Users/lzh/Documents/AI/stable-diffusion-webui/launch.py", line 372, in start import webui File "/Users/lzh/Documents/AI/stable-diffusion-webui/webui.py", line 22, in <module> import gradio File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/__init__.py", line 3, in <module> import gradio.components as components File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/components.py", line 34, in <module> from gradio import media_data, processing_utils, utils File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/processing_utils.py", line 23, in <module> from gradio import encryptor, utils File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 416, in <module> class AsyncRequest: File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 436, in AsyncRequest client = httpx.AsyncClient() File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_client.py", line 1411, in __init__ self._mounts: typing.Dict[URLPattern, typing.Optional[AsyncBaseTransport]] = { File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_client.py", line 1414, in <dictcomp> else self._init_proxy_transport( File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_client.py", line 1467, in _init_proxy_transport return AsyncHTTPTransport( File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 296, in __init__ raise ImportError( ImportError: Using SOCKS proxy, but the 'socksio' package is not installed. Make sure to install httpx using `pip install httpx[socks]`.
"pip install httpx[socks]" to the target venv (/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/), not default path of python env, and it works.
i tried the method 2 "add code 'pip install socksio"
i added code at this place.
maybe you can have reference.
Still have the same issue on my new Mac mini M2
have the same issue on my mac pro m1, Here's how I solved it:
It must have something to do with the local sock5 proxy configuration. I used clashx and added this configuration to solve the problem
With m2 chip, I tried the mentioned commands but all failed except this one:
Try turning off the command line proxy
I have the same issue, but the way did not work for me. I use M1 Pro 2021, and I am in China with Great Firewall. Usually I will Use v2ray. Here are the things i did. 1️⃣The method @gafish provides "turn off the command line proxy". It did not work.❌ I edited it in the Terminal with the code
unset http_proxy unset https_proxy
I also had try turn off the v2ray App. 2️⃣ The method @hjiajing provides "add code 'pip install socksio'". It did not work.❌ Otherwise, I had install httpx[socks] and socksio in the Python3.10.6 path. So what should I do now?lzh@LZHdeMacBook-Pro stable-diffusion-webui % ./webui.sh ################################################################ Install script for stable-diffusion + Web UI Tested on Debian 11 (Bullseye) ################################################################ ################################################################ Running on lzh user ################################################################ ################################################################ Repo already cloned, using it as install directory ################################################################ ################################################################ Create and activate python venv ################################################################ ################################################################ Launching launch.py... ################################################################ Python 3.10.6 (v3.10.6:9c7b4bd164, Aug 1 2022, 17:13:48) [Clang 13.0.0 (clang-1300.0.29.30)] Commit hash: a9fed7c364061ae6efb37f797b6b522cb3cf7aa2 Installing requirements for Web UI Launching Web UI with arguments: --upcast-sampling --no-half-vae --use-cpu interrogate Traceback (most recent call last): File "/Users/lzh/Documents/AI/stable-diffusion-webui/launch.py", line 381, in <module> start() File "/Users/lzh/Documents/AI/stable-diffusion-webui/launch.py", line 372, in start import webui File "/Users/lzh/Documents/AI/stable-diffusion-webui/webui.py", line 22, in <module> import gradio File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/__init__.py", line 3, in <module> import gradio.components as components File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/components.py", line 34, in <module> from gradio import media_data, processing_utils, utils File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/processing_utils.py", line 23, in <module> from gradio import encryptor, utils File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 416, in <module> class AsyncRequest: File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 436, in AsyncRequest client = httpx.AsyncClient() File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_client.py", line 1411, in __init__ self._mounts: typing.Dict[URLPattern, typing.Optional[AsyncBaseTransport]] = { File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_client.py", line 1414, in <dictcomp> else self._init_proxy_transport( File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_client.py", line 1467, in _init_proxy_transport return AsyncHTTPTransport( File "/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/httpx/_transports/default.py", line 296, in __init__ raise ImportError( ImportError: Using SOCKS proxy, but the 'socksio' package is not installed. Make sure to install httpx using `pip install httpx[socks]`.
"pip install httpx[socks]" to the target venv (/Users/lzh/Documents/AI/stable-diffusion-webui/venv/lib/python3.10/site-packages/), not default path of python env, and it works.
Thanks bro!
Just disable the proxy in the command line, input the following 3 cmd:
unset https_proxy; unset http_proxy; unset all_proxy;
and then run webui.sh
one reason for this is because you didn't install the package 'socksio'. run pip install socksio
can solve this problem. However, if you installed multiple version of python, then you should install the package for the one called by webui.sh.
actually, my version of webui.sh uses its own python under ./venv/bin/python so you can just run [your stable diffussion address]/venv/bin/python -m pip install socksio
Two methods both works for me:
- run
unset all_proxy
in terminal before launching the webui - add
pip install socksio
in webui.sh before the lineKEEP_GOING=1
(I prefer this)
The reason why adding pip install socksio
in webui.sh
works but not outside in terminal is because use_venv=1
is set in webui.sh
. So you can find the folder venv/
in your stable-diffusion-webui
, the python actually running and every package is NOT the same as your python environment. Thus, if you have been using conda/virtualenv and prepared specific env for SD webui, just set use_venv=0
. And then directly install socksio
in your env.
For users in GFW: 我自己试了了两个方法都行:
- 在运行webui之前在命令行取消socks代理
unset all_proxy
- 如上面的回复所说,在
webui.sh
文件中的KEEP_GOING=1
行之前,加一行pip install socksio
(我用这个)
原理:之所以在webui.sh
中pip install socksio
能用,但在外面命令行就不好使,是因为webui.sh
的开头有一句use_venv=1
。因此,你能在SD的文件夹里找到venv/
,SD启动时候所有python环境都在这个指定的独立环境里,难怪在自己环境安装socksio没有任何作用。
如果你已经为SD准备好一个conda/virtualenv环境,直接设置use_venv=0
吧,这样在命令行里 pip install socksio
就可以生效了。
I add like this
this is work for me ,thanks
have the same issue on my mac pro m1, Here's how I solved it:
It must have something to do with the local sock5 proxy configuration. I used clashx and added this configuration to solve the problem
@kelaocai Great work, you are the best genius in China, thanks man!!! It's work for me. 中国的朋友们,你如果不想开全局代理的话,就得多加这一行
我的 mac pro m1 也有同样的问题,下面是我解决方法:
肯定跟本地的sock5代理配置有关系,我用的是clashx,加上这个配置就解决了
我的 mac pro m1 也有同样的问题,下面是我解决办法:
肯定跟本地的sock5代理配置有关系,我用的是clashx,加上这个配置就解决了
我也用的clashx,加上上面的代码就ok了