[Distutils] problem finding dll with C extension

mike cantor mcantor at stanford.edu
Fri Dec 16 21:44:54 CET 2005


Hi,

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,
-mike




More information about the Distutils-SIG mailing list