3

to preface , I've already visited this issue, this question and also this question but none of these solved my problem.

I'm currently on the eclipse environment and am using the anaconda python interpreter in my project. I have this piece of code:

from PIL import Image, ImageTk
# other imports

# ....
# def initUI(self):
    pic1 = Image.open("pic1.jpg")
    pic1_img = ImageTk.PhotoImage(pic1)
    label1 = Label(self, image=pic1_img)
    label1.image = pic1_img
    label1.place(x=20, y=20)

Now upon running I get this output

Traceback (most recent call last):
  File "C:\Users\...\workspace\Tkinter_tutorial\absolutePositioning.py", line 46, in <module>
    main()
  File "C:\Users\...\workspace\Tkinter_tutorial\absolutePositioning.py", line 42, in main
    app = Window(root)
  File "C:\Users\...\workspace\Tkinter_tutorial\absolutePositioning.py", line 12, in __init__
    self.initUI()
  File "C:\Users\....\workspace\Tkinter_tutorial\absolutePositioning.py", line 22, in initUI
    pic1_img = ImageTk.PhotoImage(pic1)
  File "C:\Users\....\Anaconda\lib\site-packages\PIL\ImageTk.py", line 116, in __init__
    self.paste(image)
  File "C:\Users\....\Anaconda\lib\site-packages\PIL\ImageTk.py", line 181, in paste
    import _imagingtk
ImportError: No module named _imagingtk

I've tried conda install Pillow , and the package is marked as already installed. Yet I continue to get this error. I'm running window 64 bit python 2.7. Has anyone else encountered this problem, and how can I fix it? Thanks

Community
  • 1
  • 1
Syntactic Fructose
  • 18,936
  • 23
  • 91
  • 177

1 Answers1

0

I ended up finding a solution to this problem, which involves removing the default pillow installation and grabbing an old version of the library.

  • First open up a command prompt (with anaconda in your path) and do

    conda remove PIL or conda remove pillow

  • Then install PIL from here , PIL-1.1.7.win32-py2.7.exe . Ensure you install it to Lib/site-packages

This worked for me and everyone else using my project that had anaconda installed

Syntactic Fructose
  • 18,936
  • 23
  • 91
  • 177