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]: issue with gradio version 3.32.0 that causes "FileNotFoundError: [Errno 2] No such file or directory:" #11040

Closed
1 task done
7orbs opened this issue Jun 5, 2023 · 24 comments
Labels
bug-report Report of a bug, yet to be confirmed platform:mac Issues that apply to Apple OS X, M1, M2, etc

Comments

@7orbs
Copy link

7orbs commented Jun 5, 2023

Is there an existing issue for this?

  • 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 7orbs added the bug-report Report of a bug, yet to be confirmed label Jun 5, 2023
@sololll
Copy link

sololll commented Jun 5, 2023

#10787 (comment)

@Arsenic110
Copy link

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

@breengles
Copy link
Contributor

breengles commented Jun 6, 2023

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

@sean-kang
Copy link

sean-kang commented Jun 6, 2023

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.

@breengles
Copy link
Contributor

breengles commented Jun 6, 2023

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.

@lllyasviel
Copy link

@AUTOMATIC1111 See also baf6946#r116673136

@manticorp
Copy link

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'

@kakaxixx
Copy link

kakaxixx commented Jun 6, 2023

the same issue

@Faishun
Copy link

Faishun commented Jun 6, 2023

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

@id88viper88id
Copy link

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

@ENTPRESTIGIOUS
Copy link

I have the same issue too

@almera-vs
Copy link

Can confirm it also happens on Debian 12

creating gradio folder in /tmp fixed the problem for me

@DejitaruJin
Copy link
Contributor

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.

@SirMoogle
Copy link

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
Copy link

Thanks; which folder would I put this file in?

@SirMoogle
Copy link

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
Copy link

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.

@suwey
Copy link

suwey commented Jun 27, 2023

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

@Milor123
Copy link

Milor123 commented Jul 9, 2023

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

@katshiny
Copy link

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

@akx akx added the platform:mac Issues that apply to Apple OS X, M1, M2, etc label Jul 26, 2023
@SirMoogle
Copy link

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

@katshiny
Copy link

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!

@happyhakka6
Copy link

have same issue on MAC ios

@catboxanon
Copy link
Collaborator

Resolved by #12717

cloudaxes pushed a commit to cloudaxes/stable-diffusion-webui-docker that referenced this issue Sep 6, 2023
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 platform:mac Issues that apply to Apple OS X, M1, M2, etc
Projects
None yet
Development

No branches or pull requests