Closed structurefall closed 3 months ago
Possibly related to #2479.
I've also seen mention that nano servers may just not have the functionality to do this, though I'm not sure exactly what is missing. It's unfortunate that the error message doesn't say which DLL it failed to load.
It appears to work on a servercore image, so that's the workaround, but this is onerous for us, so I'd like to know what the specific dependency is in the hopes of installing just that on a nanoserver image.
Yes, we test released wheels using the servercore image: https://github.com/python-pillow/Pillow/blob/f8a9a18e7dc9a4ce67d46509e1a3c37fa1a7d942/.github/workflows/wheels.yml#L217-L223 It is likely that I tested nanoserver when adding this and rejected it due to this error.
The error message "The specified procedure could not be found" is different from the usual "The specified module could not be found", so I'm not sure that you'll just be able to add a dependency. Your error says that a DLL dependency was found, but does not contain all of the required functions.
Nevertheless, I'll take a look with Dependency Walker.
The following dependencies are listed with Dependencies:
C:\Users\Nulano\Downloads\Dependencies_x64_Release> Dependencies.exe -depth 1 -modules C:\Users\Nulano\AppData\Roaming\Python\Python311\site-packages\pil\_imaging.cp311-win_amd64.pyd
[ROOT] _imaging.cp311-win_amd64.pyd : C:\Users\Nulano\AppData\Roaming\Python\Python311\site-packages\pil\_imaging.cp311-win_amd64.pyd
[ApiSetSchema] api-ms-win-crt-heap-l1-1-0.dll : C:\Windows\system32\ucrtbase.dll
[ApiSetSchema] api-ms-win-crt-stdio-l1-1-0.dll : C:\Windows\system32\ucrtbase.dll
[ApiSetSchema] api-ms-win-crt-string-l1-1-0.dll : C:\Windows\system32\ucrtbase.dll
[ApiSetSchema] api-ms-win-crt-runtime-l1-1-0.dll : C:\Windows\system32\ucrtbase.dll
[ApiSetSchema] api-ms-win-crt-math-l1-1-0.dll : C:\Windows\system32\ucrtbase.dll
[ApiSetSchema] api-ms-win-crt-utility-l1-1-0.dll : C:\Windows\system32\ucrtbase.dll
[ApiSetSchema] api-ms-win-crt-convert-l1-1-0.dll : C:\Windows\system32\ucrtbase.dll
[ApiSetSchema] api-ms-win-crt-environment-l1-1-0.dll : C:\Windows\system32\ucrtbase.dll
[WellKnownDlls] KERNEL32.dll : C:\Windows\system32\kernel32.dll
[WellKnownDlls] USER32.dll : C:\Windows\system32\user32.dll
[WellKnownDlls] GDI32.dll : C:\Windows\system32\gdi32.dll
[WindowsFolder] VCRUNTIME140.dll : C:\Windows\system32\VCRUNTIME140.dll
[NOT_FOUND] python311.dll :
I was unable to figure out the mappings for some of them, but even the KERNEL32.dll
imports (which I assume map to KernelBase.dll
in servernano) are incomplete; the following symbols are missing (by manually comparing the _imaging imports with kernelbase.dll exports):
CreateFileMappingA (CreateFileMappingW is available)
GlobalLock
GlobalUnlock
RtlCaptureContext
RtlLookupFunctionEntry
RtlVirtualUnwind
WakeConditionVariable
Assuming the api-*.dll
files map to ucrtbase.dll
, they seem to be fully satisfied.
I was unable to figure out what USER32.dll
and GDI.dll
map to, but I suspect these are not present at all in nanoserver, so you'd need to compile Pillow without PIL.ImageGrab
(and likely more modules, e.g. PIL.ImageDraw
).
Also note that we don't support compiling without these modules, and #8211 is open to remove old (and untested) compile flags that potentially could have been used to achieve that.
Doing some grep searches, I can see that you'd need to disable at least the following to avoid some of the symbols above:
CreateFileMappingA
- used in libtiff, freetype, harfbuzzGlobalLock
and GlobalUnlock
- used in libwebp and libtiff, as well as display.c
WakeConditionVariable
- used in libwebp and xzSo it might actually be easier to keep using servercore.
Yeah, I definitely don't want to pin us to anything old or unsupported. servercore will work for now, thank you for looking into it!
Fascinating issue, thanks @structurefall @nulano
servercore will work for now, thank you for looking into it!
Does that mean this issue is resolved?
Everybody's going to love this one. I assure you, I have a good reason for wanting this!
I have a Python 3.10.11 install running on a Windows Docker nanoserver ltsc2022 image.
After installing pillow 10.4.0 via pip, doing
import Image from PIL
results in the following:It appears to work on a servercore image, so that's the workaround, but this is onerous for us, so I'd like to know what the specific dependency is in the hopes of installing just that on a nanoserver image.
Thanks!