Skip to content
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

AttributeError: module 'PIL.Image' has no attribute 'Resampling' #111

Open
tralala87 opened this issue Feb 2, 2023 · 15 comments · May be fixed by #114
Open

AttributeError: module 'PIL.Image' has no attribute 'Resampling' #111

tralala87 opened this issue Feb 2, 2023 · 15 comments · May be fixed by #114
Labels
bug Something isn't working

Comments

@tralala87
Copy link

Getting this error: AttributeError: module 'PIL.Image' has no attribute 'Resampling'

Any idea how to solve this?

@hmartiro hmartiro added the bug Something isn't working label Feb 2, 2023
@hmartiro
Copy link
Member

hmartiro commented Feb 2, 2023

I believe you just need an upgraded verison of pillow. Have you tried pillow>=9.1.0 per the requirements file?

@tralala87
Copy link
Author

Yes, I have tried 9.4.0

@piiq
Copy link

piiq commented Feb 5, 2023

9.4 has taken out the deprecated method to call this Resampling thing so that from diffusers import StableDiffusionImg2ImgPipeline import fails.

It works if you use pillow 9.1 to 9.3

@tralala87
Copy link
Author

Nope, unfortunately it doesn't.

@piiq
Copy link

piiq commented Feb 5, 2023

How are you using it? I was running riffusion in a colab notebook just a few hours ago.

Anyway, this can be fixed. I can find some time for a PR later this week if this will still be up for grabs

@tralala87
Copy link
Author

I used colab as well.

@piiq
Copy link

piiq commented Feb 6, 2023

Restart the kernel after installing older version on pillow

@tralala87
Copy link
Author

Restart the kernel after installing older version on pillow

I did

@thedch
Copy link

thedch commented Feb 6, 2023

Hi @tralala87 can you share a link to your colab notebook perhaps, or share steps to reproduce this issue? I'd be happy to take a look.

@tralala87
Copy link
Author

@thedch
Copy link

thedch commented Feb 8, 2023

@tralala87 Thanks! I was able to reproduce the issue.

Commenting out the last line in the Install requirements cell fixed it for me, so:

#@title Install requirements (you may need to restart the kernel after this)
!pip install -r requirements.txt
!pip install gradio
# !pip install --upgrade pillow

For some reason that last line was causing issues for me.

I recommend running

import PIL
PIL.__version__

and making sure the output is 9.4.0. If it's not, restart the runtime and try again. It was 7.1.2 for me until I commented out that line. Colab environment management can be finnicky.

@piiq piiq linked a pull request Feb 12, 2023 that will close this issue
@tralala87
Copy link
Author

I still get the error.

@piiq
Copy link

piiq commented Feb 19, 2023

I still get the error.

Fix incoming!

@KKGo1999
Copy link

Same error here! Pillow 9.4.0

AttributeError: module 'PIL.Image' has no attribute 'Resampling'

@coffeeorgreentea
Copy link

coffeeorgreentea commented Mar 30, 2023

By default colab has a version of Pillow installed that does not work. You need to restart your runtime in colab after running:

install pip intall -r 'requirements.txt'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants