[Distutils] problem finding dll with C extension

mike cantor mcantor at stanford.edu
Sat Dec 17 01:31:41 CET 2005

Another piece of information.  The error message I get ("ImportError: DLL 
load failed: The specified module could not be found") is different that 
the error message I get if I try to import a non-existent module (namely, 
"ImportError: No module named Foo").  So somewhere within the module a DLL 
is failing to load.  Any ideas????

At 12:44 PM 12/16/2005, mike cantor wrote:
>I have just built a C extension.  "python setup.py install" successfully 
>builds the extension and puts the library , PGModule.pyd, in the 
>Python23\Lib\site-packages folder.  However, from within Python, "import 
>PGModule" yields "ImportError: DLL load failed: The specified module could 
>not be found"
>The setup.py file I am using looks like this:
>from distutils.core import setup, Extension
>setup(name='PGModule', ext_modules=[ Extension('PGModule',
>         sources = ['PGfit_DataTypes.c', 'PGModule.c'],
>         include_dirs=["E:\Program 
> Files\GnuWin32\include","E:\sundials\includes"],
>         libraries = ["libgsl"],
>         library_dirs = ["E:\Program Files\GnuWin32\lib"]) ])
>A few more clues/oddities:  The extension uses the gsl (gnu scientific 
>library) library.  Without the "libraries" and "library_dir" flags, my 
>code compiles fine but does not link (I get error messages like "in 
>PGModule.o unidentified reference gsl_set_vector" etc).  Other extensions 
>that I compile from the same directory and using the same setup file, but 
>minus the library flags, build fine and are importable and usable from 
>within Python.  When I look in the site-packages folder, PGModule.pyd is 
>right there along with other modules (e.g. PGFit.pyd), yet "import 
>PGModule" from a python shell yields the aforementioned error while 
>"import PGFit" executes successfully.
>Any ideas?
>Thanks a ton,

More information about the Distutils-SIG mailing list