Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Cannot import name 'Image' from 'PIL' (unknown location) #266

Open
slavakurilyak opened this issue Feb 22, 2023 · 2 comments
Open

Cannot import name 'Image' from 'PIL' (unknown location) #266

slavakurilyak opened this issue Feb 22, 2023 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@slavakurilyak
Copy link

slavakurilyak commented Feb 22, 2023

馃悰 Bug

I am trying to create a Lightning BYOC cluster

To Reproduce

Steps to reproduce the behavior:

  1. Run lightning create cluster <cluster-name> --role-arn <ARN> --external-id <EXTERNAL-ID>

Traceback (most recent call last):

  File "/usr/local/bin/lightning", line 5, in <module>
    from lightning.app.cli.lightning_cli import main
  File "/usr/local/lib/python3.9/site-packages/lightning/__init__.py", line 32, in <module>
    from lightning.app import storage  # noqa: E402
  File "/usr/local/lib/python3.9/site-packages/lightning/app/__init__.py", line 25, in <module>
    from lightning.app import components  # noqa: E402, F401
  File "/usr/local/lib/python3.9/site-packages/lightning/app/components/__init__.py", line 15, in <module>
    from lightning.app.components.serve.serve import ModelInferenceAPI
  File "/usr/local/lib/python3.9/site-packages/lightning/app/components/serve/serve.py", line 28, in <module>
    from lightning.app.components.serve.types import _DESERIALIZER, _SERIALIZER
  File "/usr/local/lib/python3.9/site-packages/lightning/app/components/serve/types/__init__.py", line 1, in <module>
    from lightning.app.components.serve.types.image import Image
  File "/usr/local/lib/python3.9/site-packages/lightning/app/components/serve/types/image.py", line 25, in <module>
    from PIL import Image as PILImage
ImportError: cannot import name 'Image' from 'PIL' (unknown location)

Code sample

Expected behavior

I'm expecting the command to work.

Environment

  • PyTorch Version (e.g., 1.0):
  • OS (e.g., Linux): macOS
  • How you installed PyTorch (conda, pip, source): virtualenv
  • Build command you used (if compiling from source):
  • Python version: 3.9
  • CUDA/cuDNN version:
  • GPU models and configuration:
  • Any other relevant information:

Additional context

I tried the following without success:

pip uninstall Pillow
pip install Pillow

I also tried:

pip install Pillow==8.3.1
@slavakurilyak slavakurilyak added bug Something isn't working help wanted Extra attention is needed labels Feb 22, 2023
@hhsecond
Copy link

It looks like your environment is broken or has some inconsistencies. Could you try installing lightning in a new environment (you don't need to install Pillow explicitly - just pip install -U lightning would do) and try again?

@slavakurilyak
Copy link
Author

slavakurilyak commented Feb 22, 2023

@hhsecond same issue. I tried pip, conda, virtualenv, and virtualenvwrapper. I also tried pip install -U lightning but the issue persists. Could this be a dependency issue, examplePIL? Pillow was a PIL fork.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants