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

ImportError: Imageio Pillow requires Pillow, not PIL! #322

Closed
Swiffers opened this issue Mar 18, 2018 · 7 comments
Closed

ImportError: Imageio Pillow requires Pillow, not PIL! #322

Swiffers opened this issue Mar 18, 2018 · 7 comments

Comments

@Swiffers
Copy link

hi,

I'm falling into this error,

Traceback (most recent call last):
  File "./script.py", line 255, in add_watermark
    watermark = (ImageClip("./watermark.png")
  File "/usr/lib/python2.7/site-packages/moviepy/video/VideoClip.py", line 968, in __init__
    img = imread(img)
  File "/usr/lib/python2.7/site-packages/imageio/core/functions.py", line 185, in imread
    reader = read(uri, format, 'i', **kwargs)
  File "/usr/lib/python2.7/site-packages/imageio/core/functions.py", line 105, in get_reader
    format = formats.search_read_format(request)
  File "/usr/lib/python2.7/site-packages/imageio/core/format.py", line 660, in search_read_format
    if format.can_read(request):
  File "/usr/lib/python2.7/site-packages/imageio/core/format.py", line 189, in can_read
    return self._can_read(request)
  File "/usr/lib/python2.7/site-packages/imageio/plugins/pillow.py", line 57, in _can_read
    Image = self._init_pillow()
  File "/usr/lib/python2.7/site-packages/imageio/plugins/pillow.py", line 43, in _init_pillow
    raise ImportError('Imageio Pillow requires Pillow, not PIL!')
ImportError: Imageio Pillow requires Pillow, not PIL!
@almarklein
Copy link
Member

Hi! It looks like you've installed PIL instead of Pillow. If this is not the case, please let me know.

@Swiffers
Copy link
Author

Swiffers commented Mar 19, 2018

It seems to be installed

> sudo pip install Pillow
Requirement already satisfied: Pillow in /usr/lib64/python2.7/site-packages

@almarklein
Copy link
Member

What does this give you?

>> import PIL
>> PIL
>> PIL.VERSION
>> PIL.PILLOW_VERSION

@Swiffers
Copy link
Author

Somehow pillow was installed in /usr/lib64/python2.7/site-packages/
But python was looking for it in /usr/lib/python2.7/site-packages/

I solved the issue by running:
pip install --target=/usr/lib/python2.7/site-packages/ --upgrade pillow

@almarklein
Copy link
Member

Odd, but glad that it is now fixed!

@chrischma
Copy link

still getting the same error in 2022. any other ideas how to solve it? thank you!

@FirefoxMetzger
Copy link
Contributor

@chrischma Hard to say without you providing more information about your situation. In general, this error comes up if your environment is ill-configured and there isn't much we can bake into the library to prevent that from happening.

A few angles to start debugging:

  • Check from which location you are importing pil: python -c "import PIL; print(PIL.__file__)" and verify that it comes from the site-packages where you can install packages to and that nothing unexpected happens.
  • try uninstalling pillow (pip uninstall pillow) and see if anything aliases the package, i.e., after you've uninstalled pillow a import PIL should raise an ImportError, if not, you have packages aliasing each other.
  • Try upgrading pillow via pip install -U pillow

If none of this provides useful insight, you will have to describe your problem in more detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants