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

[Bug]: AssertionError: Couldn't find Stable Diffusion in any of: ['/Users/pete/Documents/stable-diffusion-webui/repositories/stable-diffusion-stability-ai', '.', '/Users/pete/Documents']

Open chrismarquardt opened this issue 3 years ago • 45 comments

Is there an existing issue for this?

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

What happened?

This happens on an M2 Mac: After the latest update (828438b..64c7b79 master -> origin/master) when running ./run_webui_mac.sh throws an error

% python webui.py --precision full --no-half --use-cpu Interrogate GFPGAN CodeFormer $@ Traceback (most recent call last): File "/Users/pete/Documents/stable-diffusion-webui/webui.py", line 11, in from modules.paths import script_path File "/Users/pete/Documents/stable-diffusion-webui/modules/paths.py", line 18, in assert sd_path is not None, "Couldn't find Stable Diffusion in any of: " + str(possible_sd_paths) AssertionError: Couldn't find Stable Diffusion in any of: ['/Users/pete/Documents/stable-diffusion-webui/repositories/stable-diffusion-stability-ai', '.', '/Users/pete/Documents']

Steps to reproduce the problem

  1. run ./run_webui_mac.sh

What should have happened?

web server with UI should start

Commit where the problem happens

64c7b79

What platforms do you use to access UI ?

MacOS

What browsers do you use to access the UI ?

Apple Safari

Command Line Arguments

From https://github.com/AUTOMATIC1111/stable-diffusion-webui
   828438b..64c7b79  master     -> origin/master
Updating 828438b..64c7b79
Fast-forward
 README.md                                      |  21 +---
 launch.py                                      |  12 +-
 modules/paths.py                               |   2 +-
 modules/sd_hijack.py                           | 296 +++++--------------------------------------
 modules/sd_hijack_clip.py                      | 301 ++++++++++++++++++++++++++++++++++++++++++++
 modules/sd_hijack_inpainting.py                |  20 +--
 modules/sd_hijack_open_clip.py                 |  37 ++++++
 modules/sd_samplers.py                         |  14 ++-
 modules/shared.py                              |  34 +++--
 modules/textual_inversion/textual_inversion.py |   7 +-
 modules/ui.py                                  |  15 +--
 requirements.txt                               |   1 +
 requirements_versions.txt                      |   1 +
 v1-inference.yaml                              |  70 +++++++++++
 webui.py                                       |   5 +-
 15 files changed, 505 insertions(+), 331 deletions(-)
 create mode 100644 modules/sd_hijack_clip.py
 create mode 100644 modules/sd_hijack_open_clip.py
 create mode 100644 v1-inference.yaml
Traceback (most recent call last):
  File "/Users/pete/Documents/stable-diffusion-webui/webui.py", line 11, in <module>
    from modules.paths import script_path
  File "/Users/pete/Documents/stable-diffusion-webui/modules/paths.py", line 18, in <module>
    assert sd_path is not None, "Couldn't find Stable Diffusion in any of: " + str(possible_sd_paths)
AssertionError: Couldn't find Stable Diffusion in any of: ['/Users/pete/Documents/stable-diffusion-webui/repositories/stable-diffusion-stability-ai', '.', '/Users/pete/Documents']

Additional information, context and logs

No response

chrismarquardt avatar Nov 26 '22 14:11 chrismarquardt

Same on Intel iMac Pro...

MCTVR avatar Nov 26 '22 14:11 MCTVR

Probably due to author trying to upgrade Stable Diffusion 2.0 to webui. It is advised to wait for the next github commit to fix the problem.

MCTVR avatar Nov 26 '22 14:11 MCTVR

Same problem detected with Mac Studio. Was working 2 hours ago but now it´s failing.

Traceback (most recent call last): File "/Users/xxx/Documents/stable-diffusion-webui/webui.py", line 11, in from modules.paths import script_path File "/Users/xxx/Documents/stable-diffusion-webui/modules/paths.py", line 19, in assert sd_path is not None, "Couldn't find Stable Diffusion in any of: " + str(possible_sd_paths) AssertionError: Couldn't find Stable Diffusion in any of: ['/Users/xxx/Documents/stable-diffusion-webui/repositories/stable-diffusion-stability-ai', '.', '/Users/xxx/Documents']

Mitheor avatar Nov 26 '22 15:11 Mitheor

Same on a M1 Pro :( I just launched ./run_webui_mac.sh which do a git pull at each launch and now I'm having the following error: Traceback (most recent call last): File "/Users/johann/Dev/ai/stable-diffusion-webui/webui.py", line 11, in <module> from modules.paths import script_path File "/Users/johann/Dev/ai/stable-diffusion-webui/modules/paths.py", line 18, in <module> assert sd_path is not None, "Couldn't find Stable Diffusion in any of: " + str(possible_sd_paths) AssertionError: Couldn't find Stable Diffusion in any of: ['/Users/johann/Dev/ai/stable-diffusion-webui/repositories/stable-diffusion-stability-ai', '.', '/Users/johann/Dev/ai']

johann-taberlet avatar Nov 26 '22 15:11 johann-taberlet

Just did a git pull --rebase ... same 828438b..64c7b79 update as OP and getting the same. M1 Max.

Homemaderobot avatar Nov 26 '22 16:11 Homemaderobot

Ok, temporary fix.

Download the files before the commit (3h ago) and delete or comment the line in the run_webui_mac: #git pull --rebase

Mitheor avatar Nov 26 '22 16:11 Mitheor

Simpler temporary fix is to do

git checkout 828438b4a190759807f9054932cae3a8b880ddf1

and use the webui in 'detached HEAD' state.

742617000027 avatar Nov 26 '22 17:11 742617000027

I had the same problem on my MBP M1 but I solved it:

To run AUTOMATIC1111 on M1, we need to pass various flags to the webui.py at runtime. So I ended up creating my own launching script which does this: python webui.py --precision full --no-half --opt-split-attention-v1 --use-cpu codeformer

The problem is that by running webui.py directly, as I do, I never update the requirements and download the necessary packages after every git pull to update AUTOMATIC1111.

I believe that the right way to update the system on a mac M1 is:

python launch.py --skip-torch-cuda-test

After I did this, the launch.py script downloaded a copy of the new Stable Diffusion repository (and many other packages) and the path error went away.

Now the program loads correctly, but I still cannot generate anything with the new SD 2.0 model due to the error buffer is not large enough. Must be 600 bytes.

system1system2 avatar Nov 26 '22 18:11 system1system2

To fix this(on Arch Linux anyway), pull and update dependencies:

git checkout master; git pull && pip install -r requirements_versions.txt --prefer-binary

Clone the missing repo:

git clone https://github.com/Stability-AI/stablediffusion repositories/stable-diffusion-stability-ai

And download the missing dependencies (open_clip, error is expected)

python launch.py

And then launch UI as normal afterwards.

C0rn3j avatar Nov 26 '22 21:11 C0rn3j

To fix this(on Arch Linux anyway), pull and update dependencies:

git checkout master; git pull && pip install -r requirements_versions.txt --prefer-binary

Clone the missing repo:

git clone https://github.com/Stability-AI/stablediffusion repositories/stable-diffusion-stability-ai

And download the missing dependencies (open_clip, error is expected)

python launch.py

And then launch UI as normal afterwards.

I tried your fix on a mac M1 Pro but I get an error when running python3 launch.py :

ERROR: Could not find a version that satisfies the requirement torch==1.12.1+cu113 (from versions: 1.11.0, 1.12.0, 1.12.1, 1.13.0)

and then if I run ./run_webui_mac.sh i have:

ModuleNotFoundError: No module named 'open_clip'

johann-taberlet avatar Nov 26 '22 23:11 johann-taberlet

Coming in to say, on Mac, all was great 30 seconds ago in Auto -- restarted terminal, git pull on stable-diffusion-webui and now get that exact error message, so yes, b5050ad directly caused this.

jet3004 avatar Nov 27 '22 00:11 jet3004

pip install open_clip_torch

fixed it for me

macordie avatar Nov 27 '22 00:11 macordie

Traceback (most recent call last):
  File "/Users/johann/Dev/ai/stable-diffusion-webui/webui.py", line 13, in <module>
    from modules import shared, devices, sd_samplers, upscaler, extensions, localization
  File "/Users/johann/Dev/ai/stable-diffusion-webui/modules/sd_samplers.py", line 11, in <module>
    from modules import prompt_parser, devices, processing, images
  File "/Users/johann/Dev/ai/stable-diffusion-webui/modules/processing.py", line 15, in <module>
    import modules.sd_hijack
  File "/Users/johann/Dev/ai/stable-diffusion-webui/modules/sd_hijack.py", line 14, in <module>
    from modules import sd_hijack_clip, sd_hijack_open_clip
  File "/Users/johann/Dev/ai/stable-diffusion-webui/modules/sd_hijack_open_clip.py", line 1, in <module>
    import open_clip.tokenizer
ModuleNotFoundError: No module named 'open_clip'

even after pip install open_clip_torch

johann-taberlet avatar Nov 27 '22 01:11 johann-taberlet

Are you running conda? If yes, did you do the activate the conda environment, before doing the PIP installation?

Activate conda environment

conda activate web-ui

pip install open_clip_torch

On Sat, Nov 26, 2022 at 8:32 PM Johann Taberlet @.***> wrote:

Traceback (most recent call last): File "/Users/johann/Dev/ai/stable-diffusion-webui/webui.py", line 13, in from modules import shared, devices, sd_samplers, upscaler, extensions, localization File "/Users/johann/Dev/ai/stable-diffusion-webui/modules/sd_samplers.py", line 11, in from modules import prompt_parser, devices, processing, images File "/Users/johann/Dev/ai/stable-diffusion-webui/modules/processing.py", line 15, in import modules.sd_hijack File "/Users/johann/Dev/ai/stable-diffusion-webui/modules/sd_hijack.py", line 14, in from modules import sd_hijack_clip, sd_hijack_open_clip File "/Users/johann/Dev/ai/stable-diffusion-webui/modules/sd_hijack_open_clip.py", line 1, in import open_clip.tokenizer ModuleNotFoundError: No module named 'open_clip'

even after pip install open_clip_torch

— Reply to this email directly, view it on GitHub https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/5071#issuecomment-1328148453, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEMZHMGZIFG447LPHYXW4WLWKK23VANCNFSM6AAAAAASMA6R5E . You are receiving this because you commented.Message ID: @.***>

macordie avatar Nov 27 '22 01:11 macordie

Same error as OP on M1 Max.

HarlanBrothers avatar Nov 27 '22 01:11 HarlanBrothers

Did you add the "stable-diffusion-stability-ai" repository as explained in the earlier post?

git clone https://github.com/Stability-AI/stablediffusion repositories/stable-diffusion-stability-ai

Here was my entire fix to get running again.

  1. Add stability-ai repository: git clone https://github.com/Stability-AI/stablediffusion repositories/stable-diffusion-stability-ai
  2. Add open_clip module: pip install open_clip_torch

The first error was about the missing "stable-diffusion-stability-ai" repository, so I added that in. The second error was about open_clip and that was fixed by adding open_clip_torch

Don't forget if you are running conda to activate your environment.

macordie avatar Nov 27 '22 02:11 macordie

Thanks. Hmmm.... this must be something really simple:

conda activate web-ui

zsh: command not found: conda

Is there a path I need to edit?

HarlanBrothers avatar Nov 27 '22 03:11 HarlanBrothers

Did you add the "stable-diffusion-stability-ai" repository as explained in the earlier post?

git clone https://github.com/Stability-AI/stablediffusion repositories/stable-diffusion-stability-ai

Here was my entire fix to get running again.

  1. Add stability-ai repository: git clone https://github.com/Stability-AI/stablediffusion repositories/stable-diffusion-stability-ai
  2. Add open_clip module: pip install open_clip_torch

The first error was about the missing "stable-diffusion-stability-ai" repository, so I added that in. The second error was about open_clip and that was fixed by adding open_clip_torch

Don't forget if you are running conda to activate your environment.

Thanks a lot, it works.

MCTVR avatar Nov 27 '22 06:11 MCTVR

Thanks. Hmmm.... this must be something really simple:

conda activate web-ui

zsh: command not found: conda

Is there a path I need to edit?

First type: bash -l

cri-st avatar Nov 27 '22 09:11 cri-st

So looks like I've got SD v2 running on M1 max by following the above suggestions (but launching with the official python webui.py --precision full --no-half --use-cpu Interrogate GFPGAN CodeFormer)

However am now getting the black square with the following samplers (with SD v1.x also): Euler a; LMS; Heun; DPM2 a; DPM++25 a; LMS Karras; DMP2 a Karras; DPM++ 2S a Karras

Also updated to latest (AToW) a89d7f4 commit and same results.

Homemaderobot avatar Nov 27 '22 11:11 Homemaderobot

Relaunching this morning 11/27, I needed to install the safetensors.

pip install safetensors

Looks like things are changing fast.
I still can't load the new 512-base-ema.ckpt without errors, but it looks like development is happening furiously. It's always fun to be on the bleeding edge.

While this has been a fun exercise on the Mac, I broke down and ordered an NVIDIA 3060 12GB ($270 on Ebay) card to put in a Linux machine for better compatibility and faster image generation. The M1 and x86 Macs with AMD have a long way to go for reasonable performance of stability of AI generated images.

macordie avatar Nov 27 '22 13:11 macordie

Thanks. Hmmm.... this must be something really simple: conda activate web-ui zsh: command not found: conda Is there a path I need to edit?

First type: bash -l

Thanks. Gets me a bit further, but still no dice:

% bash -l conda activate web-ui /Users/harlanbrothers/miniconda/bin/conda: line 3: import: command not found /Users/harlanbrothers/miniconda/bin/conda: conda: line 6: syntax error near unexpected token sys.argv' /Users/harlanbrothers/miniconda/bin/conda: conda: line 6: if len(sys.argv) > 1 and sys.argv[1].startswith('shell.') and sys.path and sys.path[0] == '':'

HarlanBrothers avatar Nov 27 '22 15:11 HarlanBrothers

However am now getting the black square with the following samplers (with SD v1.x also): Euler a; LMS; Heun; DPM2 a; DPM++25 a; LMS Karras; DMP2 a Karras; DPM++ 2S a Karras

Now appears to be working with all samplers on SD 1.x and SD 2 for me... with a catch: I need to load in an SD 1.x checkpoint first.

My route to getting it working was installing latest stable pytorch 1.13 (had been using recommended 1.13.0.dev20220922 nightly) which fixed my black squares with SD 1.x issue but running SD2 768-v-ema.ckpt would crash with...

/AppleInternal/Library/BuildRoots/f0468ab4-4115-11ed-8edc-7ef33c48bc85/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Types/MPSNDArray.mm:794: failed assertion [MPSNDArray, initWithBuffer:descriptor:] Error: buffer is not large enough. Must be 600 bytes

Abort trap: 6

I updated to webui 9e78d2c and got this ModuleNotFoundError: No module named 'safetensors' So pip install safetensors...

and I've found it now works but as mentioned only if I load in an SD1.x checkpoint first otherwise I get the above Error: buffer is not large enough. Must be 600 bytes

I'm not getting the best images out of SD2 but could be just getting to grips with params and prompts (have read as much elsewhere).

Homemaderobot avatar Nov 27 '22 17:11 Homemaderobot

Here is what helped for me on Mac M1 to fix this issue. Run the following commands in the webui directory:

git pull
pip install -r requirements_versions.txt --prefer-binary
git clone https://github.com/Stability-AI/stablediffusion repositories/stable-diffusion-stability-ai
conda activate web-ui
pip install open_clip_torch
pip install safetensors

Then you can run normaly with classical ./run_webui_mac.sh

No other command needed.

ioma8 avatar Nov 27 '22 19:11 ioma8

Here is what helped for me on Mac M1 to fix this issue. Run the following commands in the webui directory:

git pull
pip install -r requirements_versions.txt --prefer-binary
git clone https://github.com/Stability-AI/stablediffusion repositories/stable-diffusion-stability-ai
conda activate web-ui
pip install open_clip_torch
pip install safetensors

Then you can run normaly with classical ./run_webui_mac.sh

No other command needed.

I did exactly that but still after ./run_webui_mac.sh I have the following ModuleNotFoundError: No module named 'safetensors'

I ran several times pip install safetensors and pip install open_clip_torch after conda activate web-ui, just seems to not find this module :(

I'm not a Python dev by no mean and I know that I had some troubles because 2 versions of python are installed, the brew one and the MacOS base one. Could it be the problem ? Should I start the install since the beginning ?

johann-taberlet avatar Nov 27 '22 21:11 johann-taberlet

Thanks. Was able to run the first two lines from the stable-diffusion-webui directory, but when I try to run from the web-ui directory (I can't find a "webui" directory), I get this:

@.*** web-ui % git pull

fatal: not a git repository (or any of the parent directories): .git

Homebrew installed miniconda in my user directory. Is this the issue?

On Sun, Nov 27, 2022 at 2:48 PM Jakub Kolcar @.***> wrote:

Here is what helped for me on Mac M1 to fix this issue. Run the following commands in the webui directory:

git pull pip install -r requirements_versions.txt --prefer-binary git clone https://github.com/Stability-AI/stablediffusion repositories/stable-diffusion-stability-ai conda activate web-ui pip install open_clip_torch pip install safetensors

Then you can run normaly with classical ./run_webui_mac.sh

No other command needed.

— Reply to this email directly, view it on GitHub https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/5071#issuecomment-1328325810, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACAD2IHE3QNAJT4WWXCN2HDWKO3ILANCNFSM6AAAAAASMA6R5E . You are receiving this because you commented.Message ID: @.***>

HarlanBrothers avatar Nov 27 '22 21:11 HarlanBrothers

Here is what helped for me on Mac M1 to fix this issue. Run the following commands in the webui directory:

git pull
pip install -r requirements_versions.txt --prefer-binary
git clone https://github.com/Stability-AI/stablediffusion repositories/stable-diffusion-stability-ai
conda activate web-ui
pip install open_clip_torch
pip install safetensors

Then you can run normaly with classical ./run_webui_mac.sh

No other command needed.

This worked for me. I started fresh, ran the setup, and then used those commands.

Thank you.

ianMAC avatar Nov 27 '22 21:11 ianMAC

Here is what helped for me on Mac M1 to fix this issue. Run the following commands in the webui directory:

git pull
pip install -r requirements_versions.txt --prefer-binary
git clone https://github.com/Stability-AI/stablediffusion repositories/stable-diffusion-stability-ai
conda activate web-ui
pip install open_clip_torch
pip install safetensors

Then you can run normaly with classical ./run_webui_mac.sh

No other command needed.

I had to insert one change before step 2 because of the following error:

anaconda-project 0.10.2 requires ruamel-yaml, which is not installed.

So this is what I did:

git pull
conda install -c conda-forge ruamel.yaml
pip install -r requirements_versions.txt --prefer-binary
git clone https://github.com/Stability-AI/stablediffusion repositories/stable-diffusion-stability-ai
conda activate web-ui
pip install open_clip_torch
pip install safetensors

@ioma8, thanks for the fix!

ParityError avatar Nov 27 '22 22:11 ParityError

This worked for me. I started fresh, ran the setup, and then used those commands.

Tried starting fresh. Now get this, even though sd-v1-4.ckpt is in the specified location:

===========STABLE DIFFUSION MODEL============

If you've already downloaded the model, you now have time to copy it yourself to stable-diffusion-webui/models/Stable-diffusion/

Skipping model installation Cloning into 'repositories/stable-diffusion'... remote: Enumerating objects: 340, done. remote: Total 340 (delta 0), reused 0 (delta 0), pack-reused 340 Receiving objects: 100% (340/340), 42.65 MiB | 42.24 MiB/s, done. Resolving deltas: 100% (116/116), done. Cloning into 'repositories/taming-transformers'... remote: Enumerating objects: 1339, done. remote: Counting objects: 100% (4/4), done. remote: Compressing objects: 100% (4/4), done. remote: Total 1339 (delta 0), reused 2 (delta 0), pack-reused 1335 Receiving objects: 100% (1339/1339), 409.77 MiB | 23.25 MiB/s, done. Resolving deltas: 100% (279/279), done. Cloning into 'repositories/CodeFormer'... remote: Enumerating objects: 395, done. remote: Total 395 (delta 0), reused 0 (delta 0), pack-reused 395 Receiving objects: 100% (395/395), 12.59 MiB | 32.54 MiB/s, done. Resolving deltas: 100% (160/160), done. Cloning into 'repositories/BLIP'... remote: Enumerating objects: 274, done. remote: Counting objects: 100% (156/156), done. remote: Compressing objects: 100% (39/39), done. remote: Total 274 (delta 130), reused 117 (delta 117), pack-reused 118 Receiving objects: 100% (274/274), 7.04 MiB | 23.49 MiB/s, done. Resolving deltas: 100% (150/150), done. Cloning into 'repositories/k-diffusion'... remote: Enumerating objects: 855, done. remote: Counting objects: 100% (393/393), done. remote: Compressing objects: 100% (138/138), done. remote: Total 855 (delta 302), reused 324 (delta 251), pack-reused 462 Receiving objects: 100% (855/855), 176.04 KiB | 2.38 MiB/s, done. Resolving deltas: 100% (574/574), done.

====================ERROR====================

The check for the models & required repositories has failed. Please check if the model is in place and the repos are cloned. You can find the model in stable-diffusion-webui/models/Stable-diffusion/sd-v1-4.ckpt You can find the repos in stable-diffusion-webui/repositories/

====================ERROR====================

HarlanBrothers avatar Nov 27 '22 22:11 HarlanBrothers

If the model is in place, then what about the repos?

I'm not super savy on this kind of stuff, I use stable diffusion as an art tool. I hit no, even though I have the model already and let it download both the model and the repos over again.

ianMAC avatar Nov 27 '22 23:11 ianMAC