Reputation: 717
Although this is a reasonably well documented problem, I can't find a solution.
I cannot import PIL and ImageTK.
Minimal example:
import Tkinter as tk
from PIL import Image, ImageTk
root = tk.Tk()
image = Image.open('live.ppm')
photo = ImageTk.PhotoImage(image)
This produces the error:
File "C:\Anaconda\lib\site-packages\PIL\ImageTk.py", line 181, in paste
import _imagingtk
ImportError: No module named _imagingtk
I have tried:
conda install pillow
conda remove PIL
But no luck.
Upvotes: 8
Views: 14099
Reputation: 366
Try to verify the extension of the image, i got the same problem, and when i modified the extension the script worked
Upvotes: 0
Reputation: 1081
Thanks for bringing this up. The ImageTk module is an extra extension that is not part of the default installation of Pillow.
This issue is long-standing: https://github.com/ContinuumIO/anaconda-issues/issues/150
We (Continuum) will investigate adding this module to our build process.
Upvotes: 4
Reputation: 717
After uninstalling pillow and PIL:
pip install image
Fixed this issue.
Upvotes: 16