-
Notifications
You must be signed in to change notification settings - Fork 26.5k
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
[Bug]: 'KeyError: '.jpg' - no longer able to create images after latest update #5603
Comments
does it work if you set it to .png? |
Ah, it does work if I set image type to .png. Even weirder, if I then change to .jpg (after successfully making a .png image), it continues to work. But if I restart the webui (leaving it set to .jpg), I'll get the same error when I try to create an image upon the next startup. The only way to create images it to change it to .png again (and then I can change it back to .jpg, which will work within that session). |
see if you can find what commit is hardcoding saving the images to png |
Same issue here, after a git pull |
@ClashSAN not really familiar enough with the code to start poking around at the moment, but I'm 99% sure that the issue was introduced in hash 685f963. I update auto1111 nearly every day, and yesterday when I ran git pull I was up-to-date (and everything worked properly). Today I updated to 685f963 and have the issue. |
@rbbrdckybk same for me, also i update every day |
Can confirm same issue with the same workaround |
Same issue here and the workaround of first saving as PNG worked for me also. |
This is because the PR #5119 used |
I've done a fresh install for a couple of days, with the minimum of extensions I use, at the moment I haven't had this problem anymore |
Hmm, some possibly helpful information (Win 10, Python 3.10.7):
Seems like the environment or PIL image support is getting degraded somewhere along the launch path... Might be a side effect of something introduced in recent versions. Update: Did a little further testing and the PIL.Images formats disappear after |
Alright, further digging showed the likely culprit to be
Simple code to put on top of launch.py to replicate:
Easiest workaround is to have |
I was able to replicate the issue with latest version of Gradio on a clean environment both on Windows and Ubuntu (WSL2). Posted an issue on Gradio github, probably some of the later SD webui updates caused Gradio to be imported before PIL which triggered this bug. |
I am able to reproduce @jokkebk 's observations, working to see if I can fix for Gradio. |
I found something very weird:
If I run this script with pycharm, it gives ONLY png (this seems to be due to pycharm professional importing matplotlib.figure for its sciplot function, see below) However, my pycharm run config has been carefully checked to make sure it is exactly the same as I would have ran it in the cmd, so I'm quite confused on why it causes a difference. Seems like gradio isn't the only cause here (although it still breaks it if it was imported, no matter how I run the python file), but it looks like some thing related to the OS too. I zoomed it down to EDIT: I finally found the root cause: |
What this means is that, relying on This seems to be a PIL issue. I opened python-pillow/Pillow#6809 |
Gradio has merged gradio-app/gradio#2846 which also fixes this. When they make a stable release, users of this repo need to update gradio. For those want to workaround their issue asap, you can either pip install directly from gradio's main branch, or do the monkey patch in https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/5838/files cc @brian000 |
Gradio has released 3.15.0 which fixes this. However SD webui seems to be only compatiable up to 3.9.0.. |
I'm at my wits end here.. Tried installing the latest gradio from their github: didn't work. Tried the monkey patch and inserting from PIL import Image at the top of launch.py and webui.py: didn't work. Even tried creating a fresh new environment, installing all the requirements from scratch: still didn't work. I'm being cornered here as I'm down to my last 100 GB on my HD and now I have to deal with the double whammy of saving as PNGs instead of JPGs. Maybe I need to create a script to convert all PNGs to JPGs in the outputs folder and run it on a cron job or something. |
Are you running your script using pycharm? |
I tried the monkey patch, but it does not work. |
Not a pycharm user either. My workaround for now is to create a Python script to convert all PNGs to JPG.
Save the above into your outputs folder as png_to_jpg.py Next, open a command prompt and install some libraries:
And create a .bat file with the single line and save it there to directly launch the script:
Every once in a while, esp if i'm low on space or i need to back up some photos, I'll run that batch file. The hardest part was figuring out how to preserve the EXIF info which includes your prompt. |
They have merged a fix at pillow, you can pip install their latest master branch |
Having trouble installing the latest Pillow due to problems with zlib.. oh well, guess I'll have to wait till Jan 3 for the fixed version to be uploaded to pypi |
Is there an existing issue for this?
What happened?
Performed a git pull to update today (to commit 685f963), was unable to generate images regardless of settings or model (using the SD 1.5 base model for the below error). Did a complete fresh re-install and the same issue persists. I get the below error regardless of settings:
Steps to reproduce the problem
What should have happened?
Normally I'd receive an image.
Been using Auto1111 for months on both Windows and Linux, through many updates and this is the first issue I've had.
Commit where the problem happens
685f963
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
The text was updated successfully, but these errors were encountered: