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

[Bug]: no 'git' module

Open Liso7150 opened this issue 1 year ago • 3 comments

Is there an existing issue for this?

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

What happened?

tart_webui() File "D:\unstable-diffusion-webui\launch.py", line 200, in start_webui import webui File "D:\unstable-diffusion-webui\webui.py", line 14, in import modules.extras File "D:\unstable-diffusion-webui\modules\extras.py", line 18, in from modules.ui import plaintext_to_html File "D:\unstable-diffusion-webui\modules\ui.py", line 42, in import modules.scripts File "D:\unstable-diffusion-webui\modules\scripts.py", line 10, in from modules import shared, paths, script_callbacks, extensions File "D:\unstable-diffusion-webui\modules\extensions.py", line 5, in import git ModuleNotFoundError: No module named 'git'

Steps to reproduce the problem

update web ui

What should have happened?

web ui should started

Commit where the problem happens

newest

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

--allow-code --gradio-img2img-tool color-sketch --max-batch-count=100 --ui-config-file=ui-config.json --no-half-vae --vae-path=models/Stable-diffusion/Breast-Expansion/hyper_vae.pt --deepdanbooru

Additional information, context and logs

venv "D:\unstable-diffusion-webui\venv\Scripts\python.exe" Python 3.10.3 (tags/v3.10.3:a342a49, Mar 16 2022, 13:07:40) [MSC v.1929 64 bit (AMD64)] Commit hash: 6e4196dc0829bd8fc17028078ae2ab25d7f00244 Installing requirements for Web UI Launching Web UI with arguments: --allow-code --gradio-img2img-tool color-sketch --max-batch-count=100 --ui-config-file=ui-config.json --no-half-vae --vae-path=models/Stable-diffusion/Breast-Expansion/hyper_vae.pt --deepdanbooru Traceback (most recent call last): File "D:\unstable-diffusion-webui\launch.py", line 206, in start_webui() File "D:\unstable-diffusion-webui\launch.py", line 200, in start_webui import webui File "D:\unstable-diffusion-webui\webui.py", line 14, in import modules.extras File "D:\unstable-diffusion-webui\modules\extras.py", line 18, in from modules.ui import plaintext_to_html File "D:\unstable-diffusion-webui\modules\ui.py", line 42, in import modules.scripts File "D:\unstable-diffusion-webui\modules\scripts.py", line 10, in from modules import shared, paths, script_callbacks, extensions File "D:\unstable-diffusion-webui\modules\extensions.py", line 5, in import git ModuleNotFoundError: No module named 'git' Press any key to continue . . .

Liso7150 avatar Nov 05 '22 20:11 Liso7150

@Liso7150 You seem to be confused with the way to use this program. To Install: right-click in a folder / file location of your choice, select open in terminal.

run git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

put your .ckpt file in the models folder

The re-install should help fix the situation

Also, you have git installed?

ClashSAN avatar Nov 05 '22 21:11 ClashSAN

It's a new requirement that was added recently fix:
pip install GitPython

remixer-dec avatar Nov 06 '22 01:11 remixer-dec

It's a new requirement that was added recently fix: pip install GitPython

This helps but should be added to conda requirements (at least for mac it isnt there)

ioma8 avatar Nov 08 '22 00:11 ioma8

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:

  • https://stackoverflow.com/questions/41060382/using-pip-to-install-packages-to-anaconda-environment

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

0xdevalias avatar Nov 14 '22 21:11 0xdevalias