"DLL Load Failed: The specified procedure could not be found."

3182
9
11-24-2010 10:57 AM
PhilMorefield
Occasional Contributor III
I've posted this elsewhere, but this new forum seems ideal:

I'm trying to bring a Python module that handles NetCDF files into ArcMap. I am able to import the module fine in IDLE or PythonWin. But when I try to import in ArcMap (Python window), I get:

Runtime error <type 'exceptions.ImportError'>: DLL load failed: The specified procedure could not be found.

1) Can somebody try to recreate this so I can eliminate my computer(s) as the problem?
2) Any ideas on how this can be corrected on my end?
3) Any ideas on how I can notify ESRI of this and ask them to investigate?

-Thanks
Tags (2)
0 Kudos
9 Replies
JasonScheirer
Regular Contributor II
This is due to the nature of the build of the ArcGIS desktop applications. It establishes its own process-level settings in Windows for various binary runtime settings, which in turn causes a failure in any compiled module which has an embedded manifest within it. The binary Python modules (.pyd) include such a manifest, and as noted on the Python.org web site's issue tracker, the issue was not fixed for Python 2.6/2.7 and may likely not be fixed in future versions as well.

One possible workaround is to use the Microsoft utility editbin to strip the manifest from the .pyd files of interest using the /ALLOWISOLATION:NO option.
0 Kudos
ChristopherGraff
New Contributor III
I'm not sure if my error is related but let's take a shot.

I have a simple python script in a toolbox.  The script is called in various models to timestamp a sqltable that the model was run. 

Run alone or from any of the models its embeded in (via ArcGIS), the script works just fine.  I also have a .Net console app running as a scheduled task to automatically run many of these models.  When run from .Net the model fails at the timestamp script with the below error:

"<type 'exceptions.ImportError'>: DLL load failed: The specified module could not be found."

I've just recently upgraded to ArcGIS 10sp2, and hence python 2.6

Thanks in advance,
-chris
0 Kudos
PhilMorefield
Occasional Contributor III
This is due to the nature of the build of the ArcGIS desktop applications. It establishes its own process-level settings in Windows for various binary runtime settings, which in turn causes a failure in any compiled module which has an embedded manifest within it. The binary Python modules (.pyd) include such a manifest, and as noted on the Python.org web site's issue tracker, the issue was not fixed for Python 2.6/2.7 and may likely not be fixed in future versions as well.

One possible workaround is to use the Microsoft utility editbin to strip the manifest from the .pyd files of interest using the /ALLOWISOLATION:NO option.


That's great information. Thanks Jason.
0 Kudos
PhilMorefield
Occasional Contributor III
This is due to the nature of the build of the ArcGIS desktop applications. It establishes its own process-level settings in Windows for various binary runtime settings, which in turn causes a failure in any compiled module which has an embedded manifest within it. The binary Python modules (.pyd) include such a manifest, and   as noted on the Python.org web site's issue tracker, the issue was not fixed for Python 2.6/2.7 and may likely not be fixed in future versions as well. 

One possible workaround is to use the   Microsoft utility editbin to strip the manifest from the .pyd files of interest using the /ALLOWISOLATION:NO option.


Jason-

So when I follow your instructions for the file in question ("netCDF4.pyd") the output I get is:

netCDF4.pyd : warning LNK4228: '/ALLOWISOLATION' invalid for a DLL; ignored

Any thoughts? Does this mean the file was compiled with the /GL option?
0 Kudos
KristofVydt
New Contributor
I recieved the same error message each time I executed the Feature Class To Geodatabase geoprocessing tool with ArcGIS Desktop 10.0 SP 2 & Python 2.6. After a repair of ArcGIS Desktop the problem had disappeared.
0 Kudos
RussellEgypt
New Contributor II
I have the same error, trying to load the NetCDF Python module. Would just like to know if somebody resolved this issue, as indicated by the possible workaround?
0 Kudos
ChristophGohlke
New Contributor
There are two reasons why the netcdf4-python windows binaries from <http://code.google.com/p/netcdf4-python/> won't work from within ArcGIS10:

1) The hdf5dll.dll file used by ArcGIS is incompatible with the one required by netcdf4-python's netcdf.dll. Some functions are missing. Hence the error message when loading netcdf.dll. Copying all netCDF4-python provided DLLs from "C:\Python26\ArcGIS10.0\lib\site-packages" to "C:\Program Files\ArcGIS\Desktop10.0\Bin" worked but might interfere with ArcGIS functions (no tested). Also there should be no other netcdf.dll files in the Windows DLL search path.

2) ArcGIS-python ships with numpy-1.3, which is quite outdated and will not work with extensions compiled with the latest numpy. Importing netcdf4-python will crash. Upgrading to numpy-1.6.1 solved this but might influence the arcpy package (not tested).

Embedded manifests are not the problem here. NetCDF4.pyd was compiled with the patch from <http://bugs.python.org/issue7833> and also netcdf.dll and all dependent DLLs are linked with the 'MANIFEST:NO' option.
0 Kudos
PhilMorefield
Occasional Contributor III
There are two reasons why the netcdf4-python windows binaries from <http://code.google.com/p/netcdf4-python/> won't work from within ArcGIS10:

1) The hdf5dll.dll file used by ArcGIS is incompatible with the one required by netcdf4-python's netcdf.dll. Some functions are missing. Hence the error message when loading netcdf.dll. Copying all netCDF4-python provided DLLs from "C:\Python26\ArcGIS10.0\lib\site-packages" to "C:\Program Files\ArcGIS\Desktop10.0\Bin" worked but might interfere with ArcGIS functions (no tested). Also there should be no other netcdf.dll files in the Windows DLL search path.

2) ArcGIS-python ships with numpy-1.3, which is quite outdated and will not work with extensions compiled with the latest numpy. Importing netcdf4-python will crash. Upgrading to numpy-1.6.1 solved this but might influence the arcpy package (not tested).

Embedded manifests are not the problem here. NetCDF4.pyd was compiled with the patch from <http://bugs.python.org/issue7833> and also netcdf.dll and all dependent DLLs are linked with the 'MANIFEST:NO' option.


Thanks Christoph. I'd read that bug report and got even more confused since it looked like the manifest issue had been fixed. Long story short, I ended up building an installer for Konrad Hinsen's ScientificPython module which is available here:

https://sourcesup.cru.fr/frs/download.php/3745/ScientificPython-2.9.1.win32-py2.6.msi

It's 100% compatible with versions of Python/numpy shipped with ArcGIS 10.
0 Kudos
PhilMorefield
Occasional Contributor III
There are two reasons why the netcdf4-python windows binaries from <http://code.google.com/p/netcdf4-python/> won't work from within ArcGIS10:

1) The hdf5dll.dll file used by ArcGIS is incompatible with the one required by netcdf4-python's netcdf.dll. Some functions are missing. Hence the error message when loading netcdf.dll. Copying all netCDF4-python provided DLLs from "C:\Python26\ArcGIS10.0\lib\site-packages" to "C:\Program Files\ArcGIS\Desktop10.0\Bin" worked but might interfere with ArcGIS functions (no tested). Also there should be no other netcdf.dll files in the Windows DLL search path.

2) ArcGIS-python ships with numpy-1.3, which is quite outdated and will not work with extensions compiled with the latest numpy. Importing netcdf4-python will crash. Upgrading to numpy-1.6.1 solved this but might influence the arcpy package (not tested).

Embedded manifests are not the problem here. NetCDF4.pyd was compiled with the patch from <http://bugs.python.org/issue7833> and also netcdf.dll and all dependent DLLs are linked with the 'MANIFEST:NO' option.


Thanks Christoph. I'd read that bug report and got even more confused since it looked like the manifest issue had been fixed. Long story short, I ended up building an installer for Konrad Hinsen's ScientificPython module which is available here:

https://sourcesup.cru.fr/frs/download.php/3745/ScientificPython-2.9.1.win32-py2.6.msi

It's 100% compatible with versions of Python/numpy shipped with ArcGIS 10.
0 Kudos