1
votes

I get an error:

Traceback (most recent call last): File "C:/Users/me/PycharmProjects/cis-service/project/project.py", line 12, > in

from PIL import Image

File "C:\Users\me\PycharmProjects\project\venv\lib\site-packages\PIL\Image.py", line 64, in

from . import _imaging as core

ImportError: DLL load failed: The specified module could not be found.

What I've tried so far was solution suggested in ImportError: DLL load failed: %1 is not a valid Win32 application for _imaging module. The only wheel that I could install was 32bit:

(venv) C:\Users\me\PycharmProjects\project>pip install Pillow-5.3.0-cp27-cp27m-win32.whl
Processing pillow-5.3.0-cp27-cp27m-win32.whl
Installing collected packages: Pillow
Successfully installed Pillow-5.3.0

My Python version:

Python 2.7.13 (default, Jan 16 2017, 09:15:04) [MSC v.1500 32 bit (Intel)] on win32).

But it didn't help at all. One thing to notice is that I've tried to install python 2.7.15 on other venv and it worked fine. But with 2.7.13 that my project uses it doesn't work. One thing to notice that this python is specific and highly modified. So I can't just reinstall it. What could be other possible solutions for this problem or how could I trace the problem to get more information? Maybe Python folder it self is missing something (like some sort of DDL)?

EDIT:

I tried to install Pillow using easy install directly to python (I made a copy of python with all env. variables instead of creating virtual env. just to see how it reacts). Still no results. Error is bit different tho: Traceback (most recent call last):

"C:/Users/me/PycharmProjects/asd78798/image2tif/image2tif.py", line 12, in from PIL import Image File "C:\python27_testing\Python27\lib\site-packages\pillow-5.3.0-py2.7-win32.egg\PIL\Image.py", line 64, in File "C:\python27_testing\Python27\lib\site-packages\pillow-5.3.0-py2.7-win32.egg\PIL_imaging.py", line 7, in File "C:\python27_testing\Python27\lib\site-packages\pillow-5.3.0-py2.7-win32.egg\PIL_imaging.py", line 6, in bootstrap ImportError: DLL load failed: The specified module could not be found.

EDIT-2:

Found program http://www.dependencywalker.com/ which I used to scan _imaging.pyd file. Possibly found which DDL's might be missing: MSVCR90.DLL, PYTHON27.DLL. I Found and downloaded MSVCR90.DLL from https://www.dll-files.com/. Still not sure what to do with it.

1
Additionally Pillow only runs into problem when python is used in Windows. On linux Pillow with this python works fine.enigmq

1 Answers

3
votes

The solution was to download new python 2.7.13 then copy python27.dll, msvcr90.dll, Microsoft.VC90.CRT.manifest from Python27 folder to my Python27 folder and Pillow started to work. http://www.dependencywalker.com/ was very handy here. When I walked through _imaging.pyd dependency file it showed that these two dll files is missing.