AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: jsonmerge not found #4587

Closed lolihopper closed 2 years ago

lolihopper commented 2 years ago

Is there an existing issue for this?

What happened?

Just tried to install and got this error.

File "C:\stable-diffusion-webui-master\modules__init__.py", line 3, in from jsonmerge.jsonvalue import JSONValue ModuleNotFoundError: No module named 'jsonmerge'

I tried to manually install jsonmerge but it said it already was so i tried to reinstall it and that did not work either. Not sure how to fix this.

Steps to reproduce the problem

Install as normal on my system

What should have happened?

It should have worked

Commit where the problem happens

When it tries to Instal requirements for Web UI

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

No response

Additional information, context and logs

No response

meetaco commented 2 years ago
conda activate web-ui
pip install jsonmerge

worked for me on my M1 Mac environment

0xdevalias commented 2 years ago

Not sure if this will work for your specific issue here, but I suspect that it possibly will:

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

lolihopper commented 2 years ago

Thank you kindly 0xdevalias I hope that works for others. I might try it eventually just to check.

I have found that using Andaconda 3 manually over the recommended way works for some reason. For anyone having issues try running Andaconda 3 and just using "python launch.py" to start the program.