I’m using Pillow in a project. Our AppVeyor tests started failing today, and it seems that Pillow-4.1.0-cp36-cp36m-win32.whl is broken. This happens with our 3.6 tests only; 2.7 works fine. The most basic import fails with a (vague) DLL error:
Traceback (most recent call last):
File "C:\projects\nikola\nikola\plugins\task\galleries.py", line 43, in <module>
from PIL import Image # NOQA
File "c:\python36\lib\site-packages\PIL\Image.py", line 56, in <module>
from . import _imaging as core
ImportError: DLL load failed: The specified procedure could not be found.
@Kwpolska Does this help? https://github.com/python-pillow/Pillow/issues/2373#issuecomment-291605720
olefile appears in our install log: https://ci.appveyor.com/project/Kwpolska/nikola/build/1.0.4838/job/fc1fageot4kjv8uq#L125
I've tested the install on my win8 vm, and it works for me.
(thinking aloud, we could run tests on appveyor against downloaded files from pypi, skipping the whole build process (in addition to the usual run)).
Reproducible with Python 3.6 (and not 2.7) on AppVeyor by installing Pillow and trying to import:
from PIL import Image
https://github.com/hugovk/test/blob/2479/test.py
build: false
environment:
matrix:
- PYTHON: "C:/Python36"
- PYTHON: "C:/Python27"
init:
- "ECHO %PYTHON%"
- ps: "ls C:/Python*"
install:
- "%PYTHON%/python.exe -m pip install -U pip setuptools"
- "%PYTHON%/Scripts/pip.exe install pillow"
test_script:
- "python.exe test.py"
https://github.com/hugovk/test/blob/2479/appveyor.yml
python.exe test.py
Traceback (most recent call last):
File "test.py", line 3, in <module>
from PIL import Image
ImportError: No module named PIL
Command exited with code 1
Also reproducible with Python 3.3, 3.4 and 3.5:
https://ci.appveyor.com/project/hugovk/test/build/1.0.3
Strangely, also reproducible on Python 3.3, 3.4, 3.5, 3.6 (and not 2.7) with Pillow==4.0.0:
https://ci.appveyor.com/project/hugovk/test/build/1.0.4
I'm using Pillow (installed with pip) in a Django (1.10.6) project and Python 3.6 (Anaconda) in Windows 10 64 bits, I upgraded my packages, found that Pillow was broken with the message in the first comment, so I had to downgrade to version 4.0.0, for it to work again.
Also reproducible on Python 3.3, 3.4, 3.5, 3.6 (and not 2.7) with Pillow==3.4.2 (last one before 4.0.0):
https://ci.appveyor.com/project/hugovk/test/build/1.0.8
Similarly with the x64 versions of Python 3 and Pillow 4.1.0. And, for example, C:Python36-x64libsite-packagesPIL contains expected things:
https://ci.appveyor.com/project/hugovk/test/build/1.0.14/job/rnof9qcxqtaah2rb#L1417
But then Nikola's tests fail with Pillow==4.1.0:
https://ci.appveyor.com/project/hugovk/nikola/build/1.0.13
And pass with Pillow==4.0.0:
https://ci.appveyor.com/project/hugovk/nikola/build/1.0.14
So it's odd I can reproduce it with earlier Pillow versions for a simple test version, but more complex Nikola tests pass on 4.0.0 but fail on 4.1.0.
Perhaps it's not (just) Pillow, but also some dependencies that were
updated in the meantime?
--
Chris Warrick https://chriswarrick.com/
On 6 Apr 2017 08:33, "Hugo" notifications@github.com wrote:
Also reproducible on Python 3.3, 3.4, 3.5, 3.6 (and not 2.7) with
Pillow==3.4.2 (last one before 4.0.0):
https://ci.appveyor.com/project/hugovk/test/build/1.0.8Similarly with the x64 versions of Python 3 and Pillow 4.1.0. And, for
example, C:Python36-x64libsite-packagesPIL contains expected things:
https://ci.appveyor.com/project/hugovk/test/build/1.0.
14/job/rnof9qcxqtaah2rb#L1417But then Nikola's tests fail with Pillow==4.1.0:
https://ci.appveyor.com/project/hugovk/nikola/build/1.0.13
And pass with Pillow==4.0.0:
https://ci.appveyor.com/project/hugovk/nikola/build/1.0.14So it's odd I can reproduce it with earlier Pillow versions for a simple
test version, but more complex Nikola tests pass on 4.0.0 but fail on 4.1.0.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/python-pillow/Pillow/issues/2479#issuecomment-292081816,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAT-m3bNSVo7fpnirGhDGlN9ssUu2ylAks5rtIcmgaJpZM4M0lL7
.
Pillow's only dependency is Olefile, and the same version is used in the Nikola pass/fail logs. All the installed dependencies are the same versions too.
There was an update to zlib to fix #2439.
The difference is that Pillow 4.1.0 was built with Python 3.6.1 while Pillow 4.0.0 was built with Python 3.6.0.
Apparently PYTHON36.DLL from Python 3.6.0 is missing functions (PySlice_AdjustIndices and PySlice_Unpack) that are used when building with Python 3.6.1.
The solution is to upgrade to Python 3.6.1.
On the bright side, not our bug. On the not so bright side.
Any chance of a helpful error message telling the user to upgrade their Python if they try to import PIL after doing a pip install Pillow on 3.6.0 on Windows?
How about undefining PySlice_GetIndicesEx? This seems to work for me:
diff --git a/_webp.c b/_webp.c
index a8c6d40..c45d1ff 100644
--- a/_webp.c
+++ b/_webp.c
@@ -1,5 +1,6 @@
#define PY_SSIZE_T_CLEAN
#include <Python.h>
+#include "Imaging.h"
#include "py3.h"
#include <webp/encode.h>
#include <webp/decode.h>
diff --git a/libImaging/ImPlatform.h b/libImaging/ImPlatform.h
index a04bd9d..71c2e0d 100644
--- a/libImaging/ImPlatform.h
+++ b/libImaging/ImPlatform.h
@@ -9,6 +9,11 @@
#include "Python.h"
+/* Workaround issue #2479 */
+#if PY_VERSION_HEX < 0x03070000 && defined(PySlice_GetIndicesEx)
+#undef PySlice_GetIndicesEx
+#endif
+
/* Check that we have an ANSI compliant compiler */
#ifndef HAVE_PROTOTYPES
#error Sorry, this library requires support for ANSI prototypes.
diff --git a/path.c b/path.c
index 824fbdd..4715e06 100644
--- a/path.c
+++ b/path.c
@@ -27,6 +27,7 @@
#include "Python.h"
+#include "Imaging.h"
#include <math.h>
Yeah, other libraries have done similar things to what @cgohlke has proposed.
cc-ing @njsmith for awareness of yet another case of this bug.
https://bugs.python.org/issue29943 has now been resolved and released in Python 3.6.2.
https://docs.python.org/3.6/whatsnew/changelog.html?highlight=pyslice_getindicesex#id12
I have the same problem with pillow 4.2.1 and 4.3.0 on python 3.6.3 (Anaconda). Downgrading to 4.1.1 solves the issue for me.
@Dimchord What OS are you on?
64-bit windows 7
hi,
I see the same issue as @Dimchord with pillow 4.3.0
In [3]: from PIL import Image
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-3-b7f01c2f8cfe> in <module>()
----> 1 from PIL import Image
~\Anaconda2\envs\python3\lib\site-packages\PIL\Image.py in <module>()
54 # Also note that Image.core is not a publicly documented interface,
55 # and should be considered private and subject to change.
---> 56 from . import _imaging as core
57 if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
58 raise ImportError("The _imaging extension was built for another "
ImportError: DLL load failed: The specified module could not be found.
I'm running python 3.6.3 on windows 10 pro.
Downgrading to pillow=4.1.1 fixed it for me
hi again
i see the same issue with 4.2.1 and 5.0.0, with python 3.6.3 on win10.
Again, downgrading to 4.1.1 fixed it for me.
I'm getting this error also, with Python 3.6.3 and pillow 5.1.0, on Windows 10.0.16299.
> python -c "from PIL import ImageDraw"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\Anaconda3\envs\moveto\lib\site-packages\PIL\ImageDraw.py", line 35, in <module>
from . import Image, ImageColor
File "c:\Anaconda3\envs\moveto\lib\site-packages\PIL\Image.py", line 60, in <module>
from . import _imaging as core
ImportError: DLL load failed: The specified module could not be found.
Downgrading to pillow 5.0.0 solved it -
> conda install pillow=5.0.0
> python -c "from PIL import ImageDraw"
>
@bburns Please see https://github.com/python-pillow/Pillow/issues/2945 and https://github.com/conda-forge/pillow-feedstock/issues/45, it's a problem with conda.
One suggested workaround:
conda remove pillow
pip install pillow
Or:
conda update --all
Most helpful comment
The difference is that Pillow 4.1.0 was built with Python 3.6.1 while Pillow 4.0.0 was built with Python 3.6.0.
Apparently
PYTHON36.DLLfrom Python 3.6.0 is missing functions (PySlice_AdjustIndicesandPySlice_Unpack) that are used when building with Python 3.6.1.The solution is to upgrade to Python 3.6.1.