Watch Question

Trouble Installing at Final Step

Related to: AI Unlimited
Date: 03/12/2022 09:08
User: Jodi Lynn
Awards:
Hello,
I'm at the final step of installing (the Start stable-diffusion), and I received this error message:
FileNotFoundError Traceback (most recent call last)
in
60 srv= getoutput('cat /content/srvr.txt')
61
---> 62 for line in fileinput.input('/usr/local/lib/python3.7/dist-packages/gradio/blocks.py', inplace=True):
63 if line.strip().startswith('self.server_name ='):
64 line = f' self.server_name = "{srv[8:]}"\n'

1 frames
/usr/lib/python3.8/fileinput.py in _readline(self)
340 pass
341 # The next few lines may raise OSError
--> 342 os.rename(self._filename, self._backupfilename)
343 self._file = open(self._backupfilename, self._mode)
344 try:

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.7/dist-packages/gradio/blocks.py' -> '/usr/local/lib/python3.7/dist-packages/gradio/blocks.py.bak'


I don't have an SD folder on my GDrive, if that's helpful.
Thank you for your help.

Answers

Date: 01/12/2022 08:32
User: Jorge Vila
Awards:
Well, sometimes happens that Colab Screen is not really updated with the SD folder.
I recommend you to go to Google Drive, delete that folder, and start with the process, it will take you 4 minutes.
If you still having issues, contact me in jorge@jorgevila.com and we can setup a zoom so I can help you in real time,
Thanks!
Date: 01/12/2022 22:16
User: Jodi Lynn
Awards:
Hello,
I deleted everything and started over, but it still didn't work when I got to the final step.
It put a green checkmark by it, but gave this error instead of the link: python3: can't open file '/content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py': [Errno 2] No such file or directory
Here's the code for it, just in case this is helpful:
#@markdown # Start stable-diffusion
from IPython.utils import capture
import time
import sys
import fileinput

Model_Version = "1.5" #@param ["1.5", "V2-512", "V2-768"]
#@markdown - Important! Choose the correct version and resolution of the model

Use_Gradio_Server = False #@param {type:"boolean"}
#@markdown - Only if you have trouble connecting to the local server

Enable_API = False #@param {type:"boolean"}
#@markdown - You can find the docs in the [wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/API)

with capture.capture_output() as cap:
if not os.path.exists('/tools/node/bin/lt'):
!npm install -g localtunnel

with capture.capture_output() as cap:
%cd /content/gdrive/MyDrive/sd/stable-diffusion-webui/
time.sleep(1)
!wget -O webui.py https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.py
!sed -i 's@gpu_call).*@gpu_call) \n shared.demo.queue(concurrency_count=111500)@' /content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py
%cd /content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/
!wget -O ui.py https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/modules/ui.py
!sed -i 's@css = "".*@with open(os.path.join(script_path, "style.css"), "r", encoding="utf8") as file:\n css = file.read()@' /content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/ui.py
%cd /content/gdrive/MyDrive/sd/stable-diffusion-webui
!wget -O style.css https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/style.css
!sed -i 's@min-height: 4.*@min-height: 5.5em;@g' /content/gdrive/MyDrive/sd/stable-diffusion-webui/style.css
%cd /content


share=''
if Use_Gradio_Server:
share='--share'
for line in fileinput.input('/usr/local/lib/python3.8/dist-packages/gradio/blocks.py', inplace=True):
if line.strip().startswith('self.server_name ='):
line = ' self.server_name = server_name\n'
if line.strip().startswith('self.server_port ='):
line = ' self.server_port = server_port\n'
sys.stdout.write(line)
clear_output()

else:
share=''
!nohup lt --port 7860 > srv.txt 2>&1 &
time.sleep(2)
!grep -o 'https[^ ]*' /content/srv.txt >srvr.txt
time.sleep(2)
srv= getoutput('cat /content/srvr.txt')

for line in fileinput.input('/usr/local/lib/python3.8/dist-packages/gradio/blocks.py', inplace=True):
if line.strip().startswith('self.server_name ='):
line = f' self.server_name = "{srv[8:]}"\n'
if line.strip().startswith('self.server_port ='):
line = ' self.server_port = 443\n'
if line.strip().startswith('self.protocol = "https"'):
line = ' self.protocol = "https"\n'
if line.strip().startswith('if self.local_url.startswith("https") or self.is_colab'):
line = ''
if line.strip().startswith('else "http"'):
line = ''
sys.stdout.write(line)

!sed -i '13s@.*@ "PUBLIC_SHARE_TRUE": "Connected",@' /usr/local/lib/python3.8/dist-packages/gradio/strings.py

!rm /content/srv.txt
!rm /content/srvr.txt

with capture.capture_output() as cap:
%cd /content/gdrive/MyDrive/sd/stablediffusion

api = '--api' if Enable_API else ''

if Model_Version == "V2-768":
configf="--config /content/gdrive/MyDrive/sd/stablediffusion/configs/stable-diffusion/v2-inference-v.yaml"
elif Model_Version == "V2-512":
configf="--config /content/gdrive/MyDrive/sd/stablediffusion/configs/stable-diffusion/v2-inference.yaml"
else:
configf=""

if os.path.exists('/usr/local/lib/python3.8/dist-packages/xformers'):
xformers="--xformers"
else:
xformers=""

try:
model
if os.path.isfile(model):
!python /content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py $share $api --disable-safe-unpickle --no-half-vae --ckpt "$model" $configf $xformers
else:
!python /content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py $share $api --disable-safe-unpickle --no-half-vae --ckpt-dir "$model" $configf $xformers
except:
!python /content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py $share $api --disable-safe-unpickle --no-half-vae $configf $xformers


Thank you for your help.
Date: 03/12/2022 09:08
User: Jorge Vila
Awards:
Respuesta Aprobada
OK, make sure to have enough space in your GDrive
Make sure you connected to your gmail account, the same where you are running the Colab Screen
Delete SD folder
If yoou still have problems, I can sort you out through a Zoom call
Contact me at jorge@jorgevila.com


Copyright jorgevila.com 2024

Helpdesk system developed for online help. If you need to contact me or use this system in your products, contact me through jorge@jorgevila.com