python - Sådan undersøger du ImportError: DLL load failed error

Indlæg af Hanne Mølgaard Plasc

Problem



Er der nogen almindelig måde at undersøge sådanne fejl ved importmodul i python på Windows? DependencyWalker hjælper ikke meget.


For eksempel har jeg problemer med Theano og Anaconda Python på Windows 8.1. Af en eller anden grund kan python ikke indlæse DLL til libgpuarray, og jeg vil gerne vide, hvordan jeg kan undersøge dette.


Sådan ser fejlen ud.


C:Users	est>python
Python 3.6.0 |Anaconda 4.3.1 (64-bit)| (default, Dec 23 2016, 11:57:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import theano
ERROR (theano.gpuarray): pygpu was configured but could not be imported or is too old (version 0.6 or higher required)
NoneType: None
>>> import pygpu
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:Users	estAnaconda3libsite-packagespygpu\_\_init\_\_.py", line 7, in <module>
    from . import gpuarray, elemwise, reduction
ImportError: DLL load failed: The specified module could not be found.


Her er Process Monitor log:


"Time of Day","Process Name","PID","Operation","Path","Result","Detail"
"18:54:04,6207404","python.exe","904","RegQueryKey","HKCU","SUCCESS","Query: HandleTags, HandleTags: 0x0"
"18:54:04,6207581","python.exe","904","RegOpenKey","HKCUSoftwarePythonPythonCore3.6Modulespygpu","NAME NOT FOUND","Desired Access: Read"
"18:54:04,6207938","python.exe","904","RegQueryKey","HKLM","SUCCESS","Query: HandleTags, HandleTags: 0x0"
"18:54:04,6208037","python.exe","904","RegOpenKey","HKLMSoftwarePythonPythonCore3.6Modulespygpu","NAME NOT FOUND","Desired Access: Read"
"18:54:04,6216013","python.exe","904","RegQueryKey","HKCU","SUCCESS","Query: HandleTags, HandleTags: 0x0"
"18:54:04,6216203","python.exe","904","RegOpenKey","HKCUSoftwarePythonPythonCore3.6Modulespygpu.gpuarray","NAME NOT FOUND","Desired Access: Read"
"18:54:04,6216495","python.exe","904","RegQueryKey","HKLM","SUCCESS","Query: HandleTags, HandleTags: 0x0"
"18:54:04,6216628","python.exe","904","RegOpenKey","HKLMSoftwarePythonPythonCore3.6Modulespygpu.gpuarray","NAME NOT FOUND","Desired Access: Read"
"18:54:04,6222903","python.exe","904","Load Image","C:Users	estAnaconda3Libsite-packagespygpugpuarray.cp36-win\_amd64.pyd","SUCCESS","Image Base: 0x7ff90ddc0000, Image Size: 0x50000"
"18:54:04,6223757","python.exe","904","RegOpenKey","HKLMSoftwareMicrosoftWindowsCurrentVersionSideBySide","SUCCESS","Desired Access: Read"
"18:54:04,6223996","python.exe","904","RegQueryValue","HKLMSOFTWAREMicrosoftWindowsCurrentVersionSideBySidePreferExternalManifest","NAME NOT FOUND","Length: 20"
"18:54:04,6224148","python.exe","904","RegCloseKey","HKLMSOFTWAREMicrosoftWindowsCurrentVersionSideBySide","SUCCESS",""
"18:54:04,6228026","python.exe","904","Load Image","C:Users	estAnaconda3Libraryingpuarray.dll","SUCCESS","Image Base: 0x7ff90dd80000, Image Size: 0x34000"
"18:54:04,6228964","python.exe","904","RegOpenKey","HKLMSoftwareMicrosoftWindowsCurrentVersionSideBySide","SUCCESS","Desired Access: Read"
"18:54:04,6229175","python.exe","904","RegQueryValue","HKLMSOFTWAREMicrosoftWindowsCurrentVersionSideBySidePreferExternalManifest","NAME NOT FOUND","Length: 20"
"18:54:04,6229324","python.exe","904","RegCloseKey","HKLMSOFTWAREMicrosoftWindowsCurrentVersionSideBySide","SUCCESS",""


Så det ser ud til, at DLL blev fundet og indlæst i procesplads.

Bedste reference