python PILLOW module import

hello,

i’m trying to import the python PILLOW module. it’s the “new” flavor of the PIL python imaging library. i’ve followed the steps listed here…

derivative.ca/wiki088/index. … ng_Modules

and found elsewhere in the forum.

so- after easy_install pillow

i get a successfully installed pillow version 2.1.0. the module will import in python without error. it’s a strange import call-

“from PIL.Image import core as _imaging”

found in the docs here

pypi.python.org/pypi/Pillow/2.1.0

in TD however, I get

File “C:/Program Files/Derivative/TouchDesigner088/bin/TouchInit.py”, line 140, in tdcustomimport
r = previousimport(*args, **kw)
ImportError: No module named PIL.Image

again the confusing part is that i get no error in python, only in TD, when trying to import.

thanks!

Hi we will give it a shot here.
The error message you see is because TouchDesigner defines its own import mechanism to allow for DAT imports etc, however it hasn’t been a problem with external module libraries yet.
-Rob.

hi,

just wondering if you had any luck using the PIL/pillow module.

i’m still unable to get it to import in td. here’s how i got it to work in python 3.2

use the binary installer here:

lfd.uci.edu/~gohlke/pythonlibs/

Pillow-2.1.0.win-amd64-py3.2.exe

then try this

stochastix.wordpress.com/2012/07 … g-library/

make sure you change the imports to

from PIL import Image
from PIL import ImageChops
from PIL import ImageFilter

works fine in python, in td when i try :

[code]import sys
mypath = “C:/Python32/Lib/site-packages/PIL”
if mypath not in sys.path:
sys.path.append(mypath)

from PIL import Image[/code]

i get

python >>> Traceback (most recent call last): File "/project1/text1", line 6, in <module> File "C:/Program Files/Derivative/TouchDesigner088/bin/TouchInit.py", line 140, in tdcustomimport r = previousimport(*args, **kw) ImportError: No module named PIL

thanks!

Still working on it. We think its related to differences in the compilation.
I’ll keep you posted when its resolved.
Cheers,
Rob.

i know this is old-

i think everything works fine with python 3.3

i use winpython as my installer- it’s got some real nice modules that work in TD as well.

Yes, switching to Python 3.3 streamlined many of the import issues we were previously experiencing.
In addition, externally installed modules should be automatically picked up by the TouchDesigner python interpreter now.
Cheers
Rob.

Still have the same problem with Pillow, TouchDesigner Build 2020.20020:

python >>> from PIL import Image
ImportError: cannot import name '_imaging' from 'PIL' (C:\Program Files\Derivative\TouchDesigner\bin\lib\site-packages\PIL\__init__.py)
python >>>
1 Like

Bump into the same problem today :frowning:

and today…

Can you describe the error?
I used pip to install pillow into a Python 3.9 environment and had no issues importing as described above.
Thanks.