Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: DLL load failed on Pillow-9.3.0-cp37-cp37m-win_amd64.whl #6701

Closed
cgohlke opened this issue Oct 29, 2022 · 5 comments
Closed

ImportError: DLL load failed on Pillow-9.3.0-cp37-cp37m-win_amd64.whl #6701

cgohlke opened this issue Oct 29, 2022 · 5 comments

Comments

@cgohlke
Copy link
Contributor

cgohlke commented Oct 29, 2022

> py -3.7 -m pip install Pillow
Collecting Pillow
  Downloading Pillow-9.3.0-cp37-cp37m-win_amd64.whl (2.5 MB)
     |████████████████████████████████| 2.5 MB 1.6 MB/s
Installing collected packages: Pillow
Successfully installed Pillow-9.3.0

> py -3.7
Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import _imagingft
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.

_imagingft.cp37-win_amd64.pyd depends on VCRUNTIME140_1.dll, which is not included with Python 3.7 and no longer included with Pillow wheels.

Solved by installing the Microsoft Visual C++ Redistributable.

@nulano
Copy link
Contributor

nulano commented Oct 29, 2022

I checked _imaging.cp37-win_amd64.pyd did not have extra CRT dependencies, but missed _imagingft.cp37-win_amd64.pyd... 😕

I've now checked all pyd files with dumpbin /dependents ...\PIL\*.pyd and this is the only one with a VCRUNTIME140_1.dll dependency.

Checking the lib files, the dependency seems to be coming from HarfBuzz due to a new default setting in Visual Studio.

I've disabled the setting in nulano@76b9975. Could you please test the wheels from this build, https://github.com/nulano/Pillow/actions/runs/3352301197 (I've attached the 3.7 wheel below)?

Pillow-9.3.0-cp37-cp37m-win_amd64.whl.zip

@nulano
Copy link
Contributor

nulano commented Oct 29, 2022

FWIW, I've just checked the wheel from my previous comment in Windows Sandbox and it seems to fix the issue.

@hugovk
Copy link
Member

hugovk commented Oct 29, 2022

Another FWIW, testing installing a wheel on GHA's windows-latest (Microsoft Windows Server 2022) / 3.7.9 and running python -c "from PIL import _imagingft":

  • Installing Pillow-9.3.0-cp37-cp37m-win_amd64.whl from PyPI: passes, why isn't this failing?

  • Installing Pillow-9.3.0-cp37-cp37m-win_amd64.whl from the zip: passes

@nulano
Copy link
Contributor

nulano commented Oct 29, 2022

  • Installing Pillow-9.3.0-cp37-cp37m-win_amd64.whl from PyPI: passes, why isn't this failing?

The redistributable library is not installed on Windows by default, but is installed on GHA as part of Visual Studio.

This issue is very similar to #5573.
There the solution was to include the C runtime libraries in Pillow wheels: #5573 (comment) and #5573 (comment)

Unlike that issue, wheels from GHA do not include LERC yet.
The only dependency in GHA wheels on the runtime that is not installed as part of Python can be disabled, see #6702 for that.
I find that disabling this is both easier to do, and produces smaller wheels.

I have tested the wheels from #6702 in a similar way as #5573 (comment), except manually. (I also have a WIP automatic test that could be added to GHA, but ran out of time before the release.)

My suggestion would be to upload the wheels from the build of #6702 in my repository (so that the Pillow version number is correct) with a build tag, similarly to #5573 (comment). You might prefer to wait for @cgohlke to confirm I didn't miss anything else.

@radarhere
Copy link
Member

#6702 has now been merged, and I've uploaded Python 3.7 wheels for Windows for PyPI, combining Pillow 9.3.0 with that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants