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: cannot import name '_imaging' from 'PIL #22

Closed
Pikamander2 opened this issue Feb 26, 2021 · 2 comments
Closed

ImportError: cannot import name '_imaging' from 'PIL #22

Pikamander2 opened this issue Feb 26, 2021 · 2 comments

Comments

@Pikamander2
Copy link
Contributor

Pikamander2 commented Feb 26, 2021

When running the example script on Windows 10 in a Python 3.8 virtual environment, I get this error:

Traceback (most recent call last):
  File "C:\Users\Pikamander2\Dropbox\Python\Image recognition\Lobe virtual environment 1\.venv\Lib\site-packages\lobe-test-1.py", line 1, in <module>
    from lobe import ImageModel
  File "C:\Users\Pikamander2\Dropbox\Python\Image recognition\Lobe virtual environment 1\.venv\Lib\site-packages\lobe\__init__.py", line 2, in <module>
    from .model.image_model import ImageModel
  File "C:\Users\Pikamander2\Dropbox\Python\Image recognition\Lobe virtual environment 1\.venv\Lib\site-packages\lobe\model\image_model.py", line 4, in <module>
    from PIL import Image
  File "C:\Users\Pikamander2\Dropbox\Python\Image recognition\Lobe virtual environment 1\.venv\Lib\site-packages\PIL\Image.py", line 94, in <module>
    from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (C:\Users\Pikamander2\Dropbox\Python\Image recognition\Lobe virtual environment 1\.venv\Lib\site-packages\PIL\__init__.py)

Googling the error returns this Stack Overflow page, which suggests that PIL and Pillow are conflicting with each other.

image

@Pikamander2
Copy link
Contributor Author

I assume that this is the problem:

Pillow >= 2.1.0 no longer supports “import _imaging”. Please use “from PIL.Image import core as _imaging” instead.

How can that be fixed?

@Pikamander2
Copy link
Contributor Author

Nevermind, I was trying to run it with IDLE instead of the command prompt, so it wasn't running in the virtual environment.

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

No branches or pull requests

1 participant