AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
143.68k stars 27.03k forks source link

[Bug]: ModuleNotFoundError: No module named 'aesthetic_clip' (after last pull) #4060

Closed ZeroCool22 closed 2 years ago

ZeroCool22 commented 2 years ago

Is there an existing issue for this?

What happened?

Error loading script: aesthetic.py
Traceback (most recent call last):
  File "C:\Users\ZeroCool22\Desktop\Auto\modules\scripts.py", line 155, in load_scripts
    exec(compiled, module.__dict__)
  File "C:\Users\ZeroCool22\Desktop\Auto\extensions\stable-diffusion-webui-aesthetic-gradients\scripts\aesthetic.py", line 3, in <module>
    import aesthetic_clip
ModuleNotFoundError: No module named 'aesthetic_clip'

Screenshot_6

Steps to reproduce the problem

  1. Launch webui-user.bat

What should have happened?

Launch normally without error message.

Commit where the problem happens

f17769cfbc3b2f455a1c3df8a91c2f55820fe4ad

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

--xformers --vae-path "C:\Users\ZeroCool22\Desktop\Auto\models\Stable-diffusion\vae-ft-mse-840000-ema-pruned.ckpt"

Additional information, context and logs

No response

MartinCairnsSQL commented 2 years ago

The last two recent commits have broken something use git checkout 9b384df to go back to the previous working commit and then git checkout master when the issue is fixed.

ZeroCool22 commented 2 years ago

The last two recent commits have broken something use git checkout 9b384df to go back to the previous working commit and then git checkout master when the issue is fixed.

git checkout master do the same as git pull?

ZeroCool22 commented 2 years ago

Fixed: https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/58cc03edd0fe8c7e64297bcfe51111caaafabfd7

MartinCairnsSQL commented 2 years ago

git checkout master changes the branch/commit based on the code history, git pull goes to GitHub and gets the commits since the folder was last updated.

0xdevalias commented 2 years ago

Rather than manually installing each missing dependency one by one, this is the 'proper' and more sustainable way to fix any missing dependency issues:

You can modify your run_webui_mac.sh to add a line that tries to install the required dependencies with pip install -r requirements.txt each time it starts, after it pulls the latest code. This would probably make a sensible default, and is fairly quick to run, so it might be worth someone telling the original author to include it in their setup script to avoid this sort of error for end users in future:

Here is what mine looks like:

#!/usr/bin/env bash -l

pyenv local anaconda3-2022.05

# This should not be needed since it's configured during installation, but might as well have it here.
conda env config vars set PYTORCH_ENABLE_MPS_FALLBACK=1

# Activate conda environment
conda activate web-ui

# Pull the latest changes from the repo
git pull --rebase

+ # Update the dependencies if needed
+ pip install -r requirements.txt

# Run the web ui
python webui.py --deepdanbooru --precision full --no-half --use-cpu Interrogate GFPGAN CodeFormer $@

# Deactivate conda environment
conda deactivate

Originally posted by @0xdevalias in https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/4109#issuecomment-1304747007


For the others who said that pip install -r requirements.txt didn't work for them, or finding that despite pip installing the individual requirements they still don't seem to 'be there', it might be an issue with your conda environment, and which pip is being used. Sometimes the version you're calling doesn't actually install the packages to the correct place, and so they can't be found later.

I have a new theory for you, based on this StackOverflow:

What do you see when you activate your conda environment, then run which -a pip?

If it's only something like:

/opt/conda/bin/pip

And not something like:

/opt/conda/envs/web-ui/bin/pip
/opt/conda/bin/pip

Then you can likely fix it by either doing a conda install pip then using pip as normal, or using python -m pip install FOO instead of using pip directly.

Originally posted by @0xdevalias in https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/4109#issuecomment-1308357941

I did a conda install pip and then used python -m, it looked like it wasn't going to work but then I changed my run script a tiny bit,

Curious, what made you think it wasn't going to work? And what was the specific change to the run script that made it work for you? Was it using requirements_versions.txt rather than requirements.txt?

python -m pip install -r requirements_versions.txt

Originally posted by @0xdevalias in https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/4109#issuecomment-1309356932


Hopefully the above helps people who are still running into this issue 🖤

Originally posted by @0xdevalias in https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/4061#issuecomment-1314398808