Skip to content

PIL.UnidentifiedImageError: cannot identify image file (Custom installation in other directories) #7575

@deliangyang

Description

@deliangyang

What did you do?

pip install -h |grep target
#  -t, --target <dir>        Install packages into <dir>. By default this
#                            multiple platforms supported by the target
#                            abis supported by the target interpreter.

mkdir -p packages
# remove the Pillow, which installed into system packages
pip uninstall Pillow
pip install -t packages Pillow

What did you expect to happen?

It imports plugins correctly

What actually happened?

It can't import plugins, when I didn't install Pillow into system packages directories

What are your OS, Python and Pillow versions?

  • OS: Debian
  • Python: 3.8.0
  • Pillow: All versions

The real format of the image is webp, you need to import PIL.WebPImagePlugin. The image is as follows:

3ae6c099102fba7a4773c3568edee0be

from packages.PIL import Image

with open('3ae6c099102fba7a4773c3568edee0be.jpg', 'rb') as fr:
    Image.open(fr)
Traceback (most recent call last):
  File "test2.py", line 4, in <module>
    Image.open(fr)
  File "/app/packages/PIL/Image.py", line 3023, in open
    raise UnidentifiedImageError(
packages.PIL.UnidentifiedImageError: cannot identify image file <_io.BufferedReader name='3ae6c099102fba7a4773c3568edee0be.jpg'>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions