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

SDWebUI behind a proxy

Open maikelsz opened this issue 2 years ago • 12 comments

Is there an existing issue for this?

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

What would your feature do ?

how to make SDWebUI work behind a proxy? during webUI startup it needs to download some resource from hugginface, and python or conda can't access the web if a proxy is used

also, since it still tries to download some resource from hugginface, this prevents its use offline.

this resource seems to be "cached" in the ".cache" folder inside the user folder, but it still searches the web on every webUI startup

Proposed workflow

just execute with a proxy setup on windows network configuration

Additional information

need sdwebui to work offline too

maikelsz avatar Oct 20 '22 04:10 maikelsz

Make the traffic from python, git and conda bypass your proxy

kybercore avatar Oct 20 '22 10:10 kybercore

Make the traffic from python, git and conda bypass your proxy

git does (don't mind the proxy), but not python and conda.

Some time ago I had this problem in another context, I looked for how to do it and it worked for me once, then it didn't work for me anymore and I couldn't do it again.

Perhaps some parameter can be included in the webui startup that allows to specify if there is a proxy, and to use it, or not, to use this configuration, or use the system one

maikelsz avatar Oct 20 '22 17:10 maikelsz

Make the traffic from python, git and conda bypass your proxy

git does (don't mind the proxy), but not python and conda.

Some time ago I had this problem in another context, I looked for how to do it and it worked for me once, then it didn't work for me anymore and I couldn't do it again.

Perhaps some parameter can be included in the webui startup that allows you to specify if there is and if to use or not a proxy, its configuration or use the system one

There is one, but it may or may not work. Let me find it.

IceChes avatar Oct 21 '22 16:10 IceChes

Try adding TRANSFORMERS_OFFLINE=1 before the batch/python script

IceChes avatar Oct 21 '22 16:10 IceChes

where? how? like this: set TRANSFORMERS_OFFLINE=1 in webui-user.bat ?

maikelsz avatar Oct 22 '22 02:10 maikelsz

where?

how?

like this:

set TRANSFORMERS_OFFLINE=1

in webui-user.bat ?

I'm not familiar with Windows so you'll have to experiment with where to put it.

IceChes avatar Oct 22 '22 15:10 IceChes

mmm...

in https://huggingface.co/docs/transformers/installation they talk about the offline use of Transformers from cached or previously downloade files. -By setting the environment variables (Linux and Windows)... -While running... -Also by getting the files beforehand, putting them to any desired folder and configuring Transformers to use them.

I think someone here should take a look to this, to bring any of that solutions to sdwebui. That should help with offline/proxies/firewall usages contexts.

maikelsz avatar Oct 22 '22 17:10 maikelsz

Hi! Have you more info on offline/firewall mode? I m interested too

misakitchi avatar Nov 03 '22 10:11 misakitchi

no yet. for me it worked once, dont know why or how, never again, before or after that

maikelsz avatar Nov 04 '22 00:11 maikelsz

Has this problem been solved?I'm facing the same situation

lightingteeth avatar Mar 19 '23 16:03 lightingteeth

e no yet, it seems theoretically it was, but nah

maikelsz avatar Apr 14 '23 16:04 maikelsz

@maikelsz @laptop-lace

  1. for git proxy:

    git config --global https.proxy <your-proxy-server>
    git config --global https.proxy http://127.0.0.1:20809 // a example
    
  2. for python3.10 in Windows, set the env like this(remember change the proxy to your proxy-server):

    image then check if python use the proxy by this command:

    python -c 'import urllib.request; print(urllib.request.getproxies())'
    // result should like this: {'https': 'http://127.0.0.1:20809'}  
    
  3. for conda: sorry, I have no idea, the above commands make sdwebui seem to work well for me now.

HeathKang avatar May 06 '23 04:05 HeathKang