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

fix FileNotFoundError error on restart on macOS (webui.sh) #13434

Closed

Conversation

shinshin86
Copy link
Contributor

Description

Hello!

In a macOS environment, when toggling the enable/disable state of extensions in the Extension tab and pressing the Apply and restart UI button, the following error log appears in the console.
Additionally, in order for changes to extensions to take effect, I need to terminate the process and then restart the functionality.

Traceback (most recent call last):
  File "/Users/username/stable-diffusion-webui/venv/lib/python3.9/site-packages/gradio/routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "/Users/username/stable-diffusion-webui/venv/lib/python3.9/site-packages/gradio/blocks.py", line 1431, in process_api
    result = await self.call_function(
  File "/Users/username/stable-diffusion-webui/venv/lib/python3.9/site-packages/gradio/blocks.py", line 1103, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/Users/username/stable-diffusion-webui/venv/lib/python3.9/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/Users/username/stable-diffusion-webui/venv/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/Users/username/stable-diffusion-webui/venv/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/Users/username/stable-diffusion-webui/venv/lib/python3.9/site-packages/gradio/utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "/Users/username/stable-diffusion-webui/modules/ui_extensions.py", line 54, in apply_and_restart
    restart.restart_program()
  File "/Users/username/stable-diffusion-webui/modules/restart.py", line 17, in restart_program
    (Path(script_path) / "tmp" / "restart").touch()
  File "/Users/username/.rye/py/cpython@3.9.18/install/lib/python3.9/pathlib.py", line 1315, in touch
    fd = self._raw_open(flags, mode)
  File "/Users/username/.rye/py/cpython@3.9.18/install/lib/python3.9/pathlib.py", line 1127, in _raw_open
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/username/stable-diffusion-webui/tmp/restart'

This error occurs due to the absence of the tmp/restart file. Upon reviewing the webui.sh script, I noticed it lacks a process to create the tmp directory.
This process is present in the webui.bat file, so I believe it's necessary to add it to webui.sh as well.

I've only tested this on a local Apple Silicon macOS environment.
I assume the webui.sh script is also used on Linux systems. If the changes are unnecessary on a Linux environment, could you let me know.
(I've only been able to test on macOS).

Best regards!

Checklist:

AUTOMATIC1111 added a commit that referenced this pull request Sep 30, 2023
@AUTOMATIC1111
Copy link
Owner

made ad3b8a1 as an alternative solution which only makes the dir when it's needed

@shinshin86
Copy link
Contributor Author

Thanks for the confirmation. Got it!

@shinshin86 shinshin86 deleted the fix-restart-error-on-mac branch September 30, 2023 05:34
k1nos added a commit to k1nos/stable-diffusion-webui that referenced this pull request Oct 11, 2023
commit 891ccb7
Author: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com>
Date:   Tue Oct 10 15:07:25 2023 +0800

    Fix lint

commit 81e94de
Author: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com>
Date:   Tue Oct 10 14:44:20 2023 +0800

    Add warning when meet emb name conflicting

    Choose standalone embedding (in /embeddings folder) first

commit 2282eb8
Author: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com>
Date:   Tue Oct 10 12:11:00 2023 +0800

    Remove dev debug print

commit 3d8b1af
Author: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com>
Date:   Tue Oct 10 12:09:33 2023 +0800

    Support string_to_param nested dict

    format:
    bundle_emb.EMBNAME.string_to_param.KEYNAME

commit 2aa485b
Author: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com>
Date:   Mon Oct 9 22:52:09 2023 +0800

    add lora bundle system

commit 7d60076
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Tue Oct 3 16:22:32 2023 +0300

    case-insensitive search for settings

commit 7717192
Merge: c4ffeb8 c2279da
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Tue Oct 3 12:38:11 2023 +0300

    Merge pull request AUTOMATIC1111#13475 from wkpark/regress-fix

    fix regression

commit c4ffeb8
Merge: dc2074c e538132
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Tue Oct 3 12:37:46 2023 +0300

    Merge pull request AUTOMATIC1111#13480 from AUTOMATIC1111/popup-fix

    Fix accidentally closing popup dialogs

commit e538132
Author: missionfloyd <missionfloyd@users.noreply.github.com>
Date:   Mon Oct 2 22:33:03 2023 -0600

    Lint

commit 86a46e8
Author: missionfloyd <missionfloyd@users.noreply.github.com>
Date:   Mon Oct 2 22:22:15 2023 -0600

    Fix accidentally closing popup dialogs

commit c2279da
Author: Won-Kyu Park <wkpark@gmail.com>
Date:   Tue Oct 3 01:16:41 2023 +0900

    fix re_param_code (regression bug PR AUTOMATIC1111#13458)

commit dc2074c
Merge: 362675e 3f763d4
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Mon Oct 2 13:05:27 2023 +0300

    Merge pull request AUTOMATIC1111#13466 from AUTOMATIC1111/denoising-none

    Change denoising_strength default to None.

commit 362675e
Merge: e3c849d 6ab0b65
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Mon Oct 2 12:47:02 2023 +0300

    Merge pull request AUTOMATIC1111#13469 from PermissionDenied7335/master

    I found a code snippet in webui.sh that disables python venv and moved it to the appropriate location

commit 6ab0b65
Author: PermissionDenied7335 <grade6_wty@163.com>
Date:   Mon Oct 2 15:43:59 2023 +0800

    Added an option not to enable venv

commit 3f763d4
Author: missionfloyd <missionfloyd@users.noreply.github.com>
Date:   Sun Oct 1 22:38:27 2023 -0600

    Change denoising_strength default to None.

commit e3c849d
Merge: c011387 deeec0b
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sun Oct 1 11:49:42 2023 +0300

    Merge pull request AUTOMATIC1111#13458 from wkpark/fieldname-regex

    fix fieldname regex

commit c011387
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sun Oct 1 11:48:41 2023 +0300

    add search field to settings

commit deeec0b
Author: Won-Kyu Park <wkpark@gmail.com>
Date:   Sun Oct 1 00:25:53 2023 +0900

    fix fieldname regex to accept additional [-/] chars

commit c7e810a
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sun Oct 1 10:15:23 2023 +0300

    add onEdit function for js and rework token-counter.js to use it

commit 7026b96
Merge: b2f9709 56ef5e9
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sun Oct 1 07:04:08 2023 +0300

    Merge pull request AUTOMATIC1111#13444 from AUTOMATIC1111/edit-attn-delimiters

    edit-attention: Allow editing whitespace delimiters

commit 56ef5e9
Author: missionfloyd <missionfloyd@users.noreply.github.com>
Date:   Sat Sep 30 21:44:05 2023 -0600

    Remove end parenthesis from weight

commit 0eb5fde
Author: missionfloyd <missionfloyd@users.noreply.github.com>
Date:   Sat Sep 30 21:20:58 2023 -0600

    Remove unneeded code

commit 0935d2c
Author: missionfloyd <missionfloyd@users.noreply.github.com>
Date:   Sat Sep 30 18:37:44 2023 -0600

    Use checkboxes for whitespace delimiters

commit b2f9709
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 10:29:10 2023 +0300

    get AUTOMATIC1111#13121 to work without restart

commit 5cc7bf3
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 10:10:57 2023 +0300

    reword sd_checkpoint_dropdown_use_short setting and add explanation

commit 416fbde
Merge: 951842d 4588170
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 10:09:45 2023 +0300

    Merge pull request AUTOMATIC1111#13121 from AUTOMATIC1111/consolidated-allowed-preview-formats

    Consolidated allowed preview formats, Fix extra network `.gif` not woking as preview

commit 1cc7c4b
Author: missionfloyd <missionfloyd@users.noreply.github.com>
Date:   Sat Sep 30 01:09:09 2023 -0600

    Allow editing whitespace delimiters

commit 951842d
Merge: 591ad1d 63485b2
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 10:02:28 2023 +0300

    Merge pull request AUTOMATIC1111#13139 from AUTOMATIC1111/ckpt-dir-path-separator

    fix `--ckpt-dir` path separator and option use `short name` for checkpoint dropdown

commit 591ad1d
Merge: fcfe5c1 ab57417
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 09:59:21 2023 +0300

    Merge pull request AUTOMATIC1111#13170 from AUTOMATIC1111/re-fix-batch-img2img-output-dir-with-script

    Re fix batch img2img output dir with script

commit fcfe5c1
Merge: a0e979b 26d0d87
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 09:49:37 2023 +0300

    Merge pull request AUTOMATIC1111#12877 from zixaphir/removeExtraNetworksFromPrompt_fix

    account for customizable extra network separators in remove code

commit a0e979b
Merge: 3aa9f01 7d4d871
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 09:48:38 2023 +0300

    Merge pull request AUTOMATIC1111#13178 from wpdong0727/fix-lora-bias-backup-reset

    fix: lora-bias-backup don't reset cache

commit 3aa9f01
Merge: 4e5d252 413123f
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 09:47:52 2023 +0300

    Merge pull request AUTOMATIC1111#13077 from sdwebui-extensions/master

    fix localization when there are multi same localization file in the extensions

commit 4e5d252
Merge: ab63054 c485a7d
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 09:46:55 2023 +0300

    Merge pull request AUTOMATIC1111#13189 from AUTOMATIC1111/make-InputAccordion-work-with-ui-config

    make InputAccordion work with ui-config

commit ab63054
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 09:34:50 2023 +0300

    write infotext to gif image as comment

commit 0c71967
Merge: b20cd35 022639a
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 09:33:14 2023 +0300

    Merge pull request AUTOMATIC1111#13068 from JaredTherriault/master

    Load comments from gif images to gather geninfo from gif outputs

commit b20cd35
Merge: 3a4290f 5b761b4
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 09:23:32 2023 +0300

    Merge pull request AUTOMATIC1111#13210 from AUTOMATIC1111/fetch-version-info-when-webui_dir-is-not-work_dir-

    fix issues when webui_dir is not work_dir

commit 3a4290f
Merge: df48222 cf1edc2
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 09:21:47 2023 +0300

    Merge pull request AUTOMATIC1111#13229 from AUTOMATIC1111/initialize-state.time_start-befroe-state.job_count

    initialize state.time_start befroe state.job_count

commit df48222
Merge: ee8e987 0ad38a9
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 09:21:08 2023 +0300

    Merge pull request AUTOMATIC1111#13231 from der3318/better-support-for-portable-git

    Better Support for Portable Git

commit ee8e987
Merge: 87b5039 afd0624
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 09:17:24 2023 +0300

    Merge pull request AUTOMATIC1111#13266 from wkpark/xyz-prepare

    xyz_grid: add prepare

commit 87b5039
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 09:11:31 2023 +0300

    add missing import, simplify code, use patches module for AUTOMATIC1111#13276

commit e309583
Merge: 7ce1f3a d9d9414
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 09:01:12 2023 +0300

    Merge pull request AUTOMATIC1111#13276 from woweenie/patch-1

    patch DDPM.register_betas so that users can put given_betas in model yaml

commit 7ce1f3a
Merge: db63cf7 663fb87
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 08:59:28 2023 +0300

    Merge pull request AUTOMATIC1111#13281 from AUTOMATIC1111/Config-states-time-ISO-in-system-time-zone

    Config states time ISO in system time zone

commit db63cf7
Merge: cdafbca d2878a8
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 08:58:07 2023 +0300

    Merge pull request AUTOMATIC1111#13282 from AUTOMATIC1111/XYZ-if-not-Include-Sub-Grids-do-not-save-Sub-Grid

    XYZ if not include sub grids do not save sub grid

commit cdafbca
Merge: 34055f9 8e355fb
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 08:55:54 2023 +0300

    Merge pull request AUTOMATIC1111#13313 from chu8129/dev

    use orderdict as lru cache:opt/bug

commit 34055f9
Merge: 9b17416 701feab
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 08:49:26 2023 +0300

    Merge pull request AUTOMATIC1111#13302 from Zolxys/patch-1

    Fix: --sd_model in "Prompts from file or textbox" script is not working

commit 9b17416
Merge: 833b9b6 fdecf81
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 08:46:48 2023 +0300

    Merge pull request AUTOMATIC1111#13372 from ezt19/patch-1

    Update dragdrop.js

commit 833b9b6
Merge: 3b0be0f d00f6dc
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 08:32:38 2023 +0300

    Merge pull request AUTOMATIC1111#13395 from AUTOMATIC1111/escape-names

    Fix viewing/editing metadata when filename contains an apostrophe

commit 3b0be0f
Merge: 4083639 99aa702
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 08:32:07 2023 +0300

    Merge pull request AUTOMATIC1111#13411 from AUTOMATIC1111/update-card-metadata

    Update card on correct tab when editing metadata

commit 4083639
Merge: 8a75838 30f4f25
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 08:31:30 2023 +0300

    Merge pull request AUTOMATIC1111#13418 from akx/torchsde-bump

    Bump to torchsde==0.2.6

commit 8a75838
Merge: ad3b8a1 a69daae
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 08:24:37 2023 +0300

    Merge pull request AUTOMATIC1111#13412 from AUTOMATIC1111/data-sort-name-fix

    Fix data-sort-name containing spaces

commit ad3b8a1
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 08:23:12 2023 +0300

    alternative solution to AUTOMATIC1111#13434

commit 1b9ca01
Merge: 102b661 ab3d352
Author: AUTOMATIC1111 <16777216c@gmail.com>
Date:   Sat Sep 30 08:15:00 2023 +0300

    Merge pull request AUTOMATIC1111#13253 from LeonZhao28/feature_skip_load_model_at_start

    add --skip-load-model-at-start

commit 30f4f25
Author: Aarni Koskela <akx@iki.fi>
Date:   Wed Sep 27 10:21:14 2023 +0300

    Bump to torchsde==0.2.6

commit a69daae
Author: missionfloyd <missionfloyd@users.noreply.github.com>
Date:   Tue Sep 26 22:02:52 2023 -0600

    Fix data-sort-name containing spaces

commit 99aa702
Author: missionfloyd <missionfloyd@users.noreply.github.com>
Date:   Tue Sep 26 21:08:55 2023 -0600

    Update card on correct tab

commit d00f6dc
Author: missionfloyd <missionfloyd@users.noreply.github.com>
Date:   Mon Sep 25 22:08:24 2023 -0600

    Escape item names

commit fdecf81
Author: ezt19 <136929737+ezt19@users.noreply.github.com>
Date:   Sat Sep 23 20:41:28 2023 +0000

    Update dragdrop.js

    Fixing a problem when u cannot put two images and they are going into two different places for images.

commit 8e355fb
Author: 王秋文/qwwang <wangqiuwen@xinyu668.com>
Date:   Mon Sep 18 16:45:42 2023 +0800

    fix

commit 701feab
Author: Zolxys <Zolxys@gmail.com>
Date:   Sun Sep 17 11:37:15 2023 -0500

    Fix: --sd_model in "Promts from file or textbox" script is not working

    Fix for bug report AUTOMATIC1111#8079

commit d9d9414
Author: woweenie <145132974+woweenie@users.noreply.github.com>
Date:   Fri Sep 15 18:59:44 2023 +0200

    patch DDPM.register_betas so that users can put given_betas in model yaml

commit 813535d
Author: qiuwen.wang <chu8129@users.noreply.github.com>
Date:   Fri Sep 15 18:23:23 2023 +0800

    use dict[key]=model; did not update orderdict order, should use move to end

commit afd0624
Author: Won-Kyu Park <wkpark@gmail.com>
Date:   Fri Sep 15 17:10:01 2023 +0900

    xyz_grid: add prepare option to AxisOption

commit ab3d352
Author: Leon <yongliang.zhao@happyelements.com>
Date:   Thu Sep 14 18:42:56 2023 +0800

    add --skip-load-model-at-start

commit 0ad38a9
Author: Der Chien <der3318@yahoo.com.tw>
Date:   Wed Sep 13 20:20:01 2023 +0800

    20230913 setup GIT_PYTHON_GIT_EXECUTABLE for GitPython

commit cf1edc2
Author: w-e-w <40751091+w-e-w@users.noreply.github.com>
Date:   Wed Sep 13 16:27:02 2023 +0900

    initialize state.time_start befroe state.job_count

commit c485a7d
Author: w-e-w <40751091+w-e-w@users.noreply.github.com>
Date:   Mon Sep 11 13:47:44 2023 +0900

    make InputAccordion work with ui-config

commit 413123f
Author: liubo0902 <38622806+liubo0902@users.noreply.github.com>
Date:   Mon Sep 11 09:22:27 2023 +0800

    Update localization.py

commit 7d4d871
Author: dongwenpu <dongwenpu@echoing.tech>
Date:   Sun Sep 10 17:53:42 2023 +0800

    fix: lora-bias-backup don't reset cache

commit 26d0d87
Author: zixaphir <zixaphirmoxphar@gmail.com>
Date:   Sat Sep 9 17:26:46 2023 -0700

    Remove extra spaces

commit d6478a6
Author: zixaphir <zixaphirmoxphar@gmail.com>
Date:   Sat Sep 9 17:22:10 2023 -0700

    Remove extra network separator without regex

commit 63485b2
Author: w-e-w <40751091+w-e-w@users.noreply.github.com>
Date:   Fri Sep 8 10:00:27 2023 +0900

    option use short name for checkpoint dropdown

commit e4726cc
Author: w-e-w <40751091+w-e-w@users.noreply.github.com>
Date:   Fri Sep 8 09:46:34 2023 +0900

    parsing string to path

commit 4588170
Author: w-e-w <40751091+w-e-w@users.noreply.github.com>
Date:   Thu Sep 7 12:11:36 2023 +0900

    consolidated allowed preview formats

commit ff7027f
Author: liubo0902 <38622806+liubo0902@users.noreply.github.com>
Date:   Tue Sep 5 15:08:59 2023 +0800

    Update localization.py

commit 0c1c9e7
Author: liubo0902 <38622806+liubo0902@users.noreply.github.com>
Date:   Tue Sep 5 15:06:47 2023 +0800

    Update localization.py

commit 022639a
Author: JaredTherriault <noirjt@live.com>
Date:   Mon Sep 4 17:37:48 2023 -0700

    Load comments from gif images to gather geninfo from gif outputs

commit 5e16914
Merge: 8f3b02f 5ef669d
Author: JaredTherriault <noirjt@live.com>
Date:   Mon Sep 4 17:29:33 2023 -0700

    Merge branch 'AUTOMATIC1111:master' into master

commit 8f3b02f
Author: JaredTherriault <noirjt@live.com>
Date:   Sun Sep 3 13:31:42 2023 -0700

    Revert "Offloading custom work"

    This reverts commit f3d1631.

    This work has been offloaded now into an extension called Prompt Control.

commit 78c1a74
Author: zixaphir <zixaphirmoxphar@gmail.com>
Date:   Thu Aug 31 14:18:35 2023 -0700

    Account for edge case where user deleted leading separator.

commit 41196cc
Author: zixaphir <zixaphirmoxphar@gmail.com>
Date:   Wed Aug 30 20:20:19 2023 -0700

    account for customizable extra network separators in remove code

    previous behavior only searched for leading spaces

commit f3d1631
Author: JaredTherriault <noirjt@live.com>
Date:   Sun Aug 27 21:54:05 2023 -0700

    Offloading custom work

    -custom_statics works to do mass replace strings, intended for copy-pasting gen info from internet generations and replacing unsavory prompts with safer prompts for my own sanity
    -tried to implement this into generation_parameters_copypaste but it didn't work out this iteration, presumably because we return a string and the calling method is looking for an object type
    -updated webui-user.bat to set a custom temp directory (for disk space concerns) and to apply xformers (for generation speed)

    I probably won't be merging any of this work into the main repo since I don't want to mess with anyone else's prompts, this is just intended to keep my workspace safe from anything I don't want to see. Eventually this should be done in an extension which I could then publish, but I need to learn a lot more about the extension and callback systems in the main repo first. just uploading this to my fork for now so i don't lose the current progress.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants