From PIL import Image _imaging DLL load failed

Hello there!

Having a strange issue during initialising custom event script and using Pillow

I have a script that reacts on OnJobFinished event and does some postprocessing with JobOutput files
One of that is sampling the resolutioin of images using PIL

I’ve created custom_python_modules folder in Repository folder and configured Additional Python Search Paths so Deadline Python executable knows where to get additional modules.
I’ve put PIL folder into custom_python_modules folder.
It worlks perfectly with some other libraries, but fails with PIllow

When I try to

import PIL

it works fine

But when I try to

from PIL import Image

I get this error in Deadline Monitor Console:

ImportError Cannot import name Image

If I put PIL folder into C:\Program Files\Thinkbox\Deadline10\bin\Lib\site-packages and use
“C:\Program Files\Thinkbox\Deadline10\bin\dpython.exe”(this is Deadline Python executable), I get this error:

>>> import PIL >>> from PIL import Image Traceback (most recent call last): File "", line 1, in File "C:\Program Files\Thinkbox\Deadline10\bin\lib\site-packages\PIL\Image.py", line 90, in from . import _imaging as core ImportError: DLL load failed: - module not found.

So looks like that Deadline Python executable fails to load _imaging.pyd

But if I try to from PIL import Image on my regular Python 2.7 installation, it works fine.

This problem only exists on Windows Deadline Installations.
If I install Deadline on MacOS, everything works fine also

I’ve used DependencyWalker to check dependancies for _imaging.pyd and looks like that _imaging.pyd tries to use some Windows DLLs from system32

Again, from PIL import Image works fine on regular python installation, but fails to execute in Deadline Environment with Deadline Python Executable

Any ideas?

OS: Windows Server 2012 R2
Deadline Client 10.0.25.2