Integrating Pillow in Blender on Windows causes errors

Hey,

as I am programming a plugin which uses the Pillow library, I am accounting a big problem on Windows 64 bit. On OS X everything runs as expected.

As Pillow is a 3rd party extension to Python I simply installed it (via pip) in my system Python and than copied the ‘PIL’ folder from the ‘libs/site-packages’ folder into my plugin. Then I appended the plugin directory to the system paths (

sys.path.append(os.path.dirname(os.path.realpath(__file__)))

) to be able to import it.

On Windows I get the following error:

File "C:\Users\<user>\AppData\Roaming\Blender Foundation\Blender\2.78\scripts\addons\<addon-name>\PIL\Image.py", line 67, in <module>
    from PIL import _imaging as core
ImportError: cannot import name '_imaging'

The ‘_imaging’ stuff is in a precompiled pyd file (_imaging.cp35-win32.pyd) in the ‘PIL’ folder. Maybe it’s because the _imaging file is a 32 bit version and the Blender Python is looking for a 64 bit version?

Cheers,
Pascal

I had the same problem. I would really be great if pillow was already in Blender, but I guess they have to worry about it keeping support?

This github thread seems to confirm that you should be using the correct build 32/64