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

[Bug]: issue with gradio version 3.32.0 that causes "FileNotFoundError: [Errno 2] No such file or directory:"

Open 7orbs opened this issue 2 years ago • 16 comments

Is there an existing issue for this?

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

What happened?

In the most recent update when gradio was updated from 3.31.0 to 3.32.0 in order to fix a few issues relating to #10762 another issue popped up where if the %localappdata%/Temp/gradio" folder didn't exist SD would pop an "FileNotFoundError: [Errno 2] No such file or directory:" error

Steps to reproduce the problem

naturally happens if you don't have a custom temporary image folder defined and a '%localappdata%/Temp/gradio' folder doesn't exist.

can also happen if you delete your custom-defined folder, there seems to be no check to make sure either folder actually exists, and likly would be fixed if it was done so,

What should have happened?

likely there needs to be a check to make sure the folder '%localappdata%/Temp/gradio' or your custom-defined temp image folder actually exists on startup.

Commit where the problem happens

baf6946

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Windows

What device are you running WebUI on?

No response

What browsers do you use to access the UI ?

No response

Command Line Arguments

--xformers

List of extensions

no

Console logs

FileNotFoundError: [Errno 2] No such file or directory: 'E:\\Ai Stuffs\\stable-diffusion-webui\\temp\\tmpk3u66409.png'

or

FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Roy\AppData\Local\Temp\gradio\tmpcm2f3nrq.png'

Additional information

apologies if this bug report is done wrong

7orbs avatar Jun 05 '23 16:06 7orbs

https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/10787#issuecomment-1576484358

sololll avatar Jun 05 '23 16:06 sololll

this can be temporarily fixed by creating the "gradio" folder in user's temp directory.

Arsenic110 avatar Jun 05 '23 17:06 Arsenic110

Can confirm the same happens on ubuntu (/tmp/gradio). It can be simply fixed by manually creating the dir

breengles avatar Jun 06 '23 03:06 breengles

I am having the same issue with the error message about /tmp/gradio/xxxx files. It does not consistently happen but I have to reload the web page once it happens.

sean-kang avatar Jun 06 '23 04:06 sean-kang

Dunno why but without extensions (like controlnet) everything works fine (both 3.31.0 and 3.32.0 gradio versions). Nevertheless, people report that the same issue appears not only with controlnet extension.

breengles avatar Jun 06 '23 06:06 breengles

@AUTOMATIC1111 See also https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/baf6946e06249c5af9851c60171692c44ef633e0#r116673136

lllyasviel avatar Jun 06 '23 07:06 lllyasviel

Getting the same issue, windows:

Traceback (most recent call last):███████████████████████████████████████████████████████████████████| 21/21 [00:17<00:00,  2.01it/s]
  File "Q:\Ai\stable-diffusion-portable-main\venv\lib\site-packages\gradio\routes.py", line 422, in run_predict
    output = await app.get_blocks().process_api(
  File "Q:\Ai\stable-diffusion-portable-main\venv\lib\site-packages\gradio\blocks.py", line 1326, in process_api
    data = self.postprocess_data(fn_index, result["prediction"], state)
  File "Q:\Ai\stable-diffusion-portable-main\venv\lib\site-packages\gradio\blocks.py", line 1260, in postprocess_data
    prediction_value = block.postprocess(prediction_value)
  File "Q:\Ai\stable-diffusion-portable-main\venv\lib\site-packages\gradio\components.py", line 4461, in postprocess
    file = self.pil_to_temp_file(img, dir=self.DEFAULT_TEMP_DIR)
  File "Q:\Ai\stable-diffusion-portable-main\modules\ui_tempdir.py", line 55, in save_pil_to_file
    file_obj = tempfile.NamedTemporaryFile(delete=False, suffix=".png", dir=dir)
  File "Q:\Ai\stable-diffusion-portable-main\python\lib\tempfile.py", line 559, in NamedTemporaryFile
    file = _io.open(dir, mode, buffering=buffering,
  File "Q:\Ai\stable-diffusion-portable-main\python\lib\tempfile.py", line 556, in opener
    fd, name = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
  File "Q:\Ai\stable-diffusion-portable-main\python\lib\tempfile.py", line 256, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
FileNotFoundError: [Errno 2] No such file or directory: 'Q:\\Ai\\stable-diffusion-portable-main\\tmp\\gradio\\tmpo07iedck.png'

manticorp avatar Jun 06 '23 07:06 manticorp

the same issue

kakaxixx avatar Jun 06 '23 09:06 kakaxixx

Creating a dir actually fixes it and it's probably more convenient. You do not have to look for some recently made images around your entire tmp folder

Faishun avatar Jun 06 '23 11:06 Faishun

In my case the issue was exactly as @7orbs said, the only difference being that the system that I work on is macOS Ventura 13.4. In the case of macOS, the gradio folder was missing in the following directory: /var/folders/lt/lz3y14d905v9tq9g5t5h019c0000gn/T/. Just as @breengles as @Faishun said, and I concluded this myself, after reading @7orbs' comment, but still before reading @breengles and @Faishun's comments, creating the missing gradio folder solved the issue. I have to point out here that prior to updating to the 1.3.2 version of Stable Diffusion from the previous version, I did not have this issue. This fact suggests, in turn, that not until after updating to the 1.3.2 version, the gradio folder was not missing, which would mean that it is only after updating to this particular version that the gradio folder in question may or does disappear

id88viper88id avatar Jun 08 '23 08:06 id88viper88id

I have the same issue too

ENTPRESTIGIOUS avatar Jun 12 '23 05:06 ENTPRESTIGIOUS

Can confirm it also happens on Debian 12

creating gradio folder in /tmp fixed the problem for me

almera-vs avatar Jun 13 '23 21:06 almera-vs

Incidentally, this follows the exported TMPDIR, which I had added in webui-user.sh so pip would stop vomiting all over my rather small OS drive. Creating the gradio folder in the set location, indeed, has resolved it, until I go cleaning out that folder.

DejitaruJin avatar Jun 14 '23 05:06 DejitaruJin

Yeah, I've been noticing this issue too. I created a gradio folder in my AppData\Local\Temp directory and the problem resolves itself without needing a UI restart, but it seems that it randomly disappears, maybe after turning off my computer.

SirMoogle avatar Jun 16 '23 00:06 SirMoogle

Thanks; which folder would I put this file in?

SirMoogle avatar Jun 18 '23 03:06 SirMoogle

Hmm, code's not working for me. Am I supposed to do git apply temp_patch.diff once I move it to my SD directory?

SirMoogle avatar Jun 19 '23 04:06 SirMoogle

Not sure why @serakeri's answers have disappeared, but I think I managed to resolve this. I opened cmd in my Stable Diffusion directory and typed pip install gradio to get it running properly.

SirMoogle avatar Jun 23 '23 21:06 SirMoogle

searched a lot, doubted sadtalker, and finally found right solution here.

suwey avatar Jun 27 '23 12:06 suwey

Can confirm the same happens on ubuntu (/tmp/gradio). It can be simply fixed by manually creating the dir

It works for me in linux, thank you very much

mkdir tmp
mkdir tmp/gradio

Milor123 avatar Jul 09 '23 11:07 Milor123

Hi I'm facing same issue now, Under which directory should I create "tmp/gradio"? directory under my stable diffusion folder? please help.

katshiny avatar Jul 26 '23 01:07 katshiny

Hi I'm facing same issue now, Under which directory should I create "tmp/gradio"? directory under my stable diffusion folder? please help.

I found it was a lot easier to define a new path for the temp folder, which you can set by going to Settings → Saving images/grids → Directory for temporary images; leave empty for default

SirMoogle avatar Jul 26 '23 23:07 SirMoogle

Hi I'm facing same issue now, Under which directory should I create "tmp/gradio"? directory under my stable diffusion folder? please help.

I found it was a lot easier to define a new path for the temp folder, which you can set by going to Settings → Saving images/grids → Directory for temporary images; leave empty for default

Thxxx.....! now everything fine!

katshiny avatar Jul 27 '23 00:07 katshiny

have same issue on MAC ios

happyhakka6 avatar Aug 24 '23 01:08 happyhakka6

Resolved by https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/12717

catboxanon avatar Aug 25 '23 02:08 catboxanon