[SciPy-dev] eggs and f2py extensions

Robert Kern robert.kern at gmail.com
Mon Jan 16 22:53:17 CST 2006

Christopher Fonnesbeck wrote:
> On Jan 16, 2006, at 3:37 PM, Pearu Peterson wrote:

>> Could you try out the following code in the header of setup.py:
>>    from numpy.distutils.core import setup
>>    import setuptools
>>    setuptools.setup = setup
>> ? If it works, numpy.distutils could overwrite setuptools.setup
>> automatically in numpy/distutils/__init__.py, for instance.
> Unfortunately, setuputils.setup does not recognize f2py modules.  Adding
> the lines above yields:

Import setuptools first and use numpy.distutils.core.setup(). The
install_requires checking doesn't happen until easy_install, so nothing should
be stomped on by numpy.distutils. setup_requires also seems to work (not shown
here). I don't know why the

  $ python -c "import setuptools; execfile('setup.py')" build

form didn't work for you.

[testf2py]$ ls
setup.py subr.f   subr.pyf
[testf2py]$ cat setup.py
import setuptools

from numpy.distutils.core import setup
from numpy.distutils.misc_util import Configuration

config = Configuration(name='subr')

kwds = {'install_requires': ['DoesNotExist'],


[testf2py]$ python setup.py build
running build
running config_fc
running build_src
building extension "subr.subr" sources
creating build
creating build/src
creating build/src/testf2py
f2py options: []
f2py: /Users/kern/src/testf2py/subr.pyf
Reading fortran codes...
        Reading file '/Users/kern/src/testf2py/subr.pyf' (format:free)
        Block: subr
                        Block: foo
Post-processing (stage 2)...
Building modules...
        Building module "subr"...
                Constructing wrapper function "foo"...
        Wrote C/API module "subr" to file "build/src/testf2py/subrmodule.c"
  adding 'build/src/fortranobject.c' to sources.
  adding 'build/src' to include_dirs.


gcc: build/src/testf2py/subrmodule.c
creating build/lib.darwin-8.3.0-Power_Macintosh-2.4
creating build/lib.darwin-8.3.0-Power_Macintosh-2.4/subr
gcc -Wl,-x -bundle -undefined dynamic_lookup
build/temp.darwin-8.3.0-Power_Macintosh-2.4/build/src/fortranobject.o -o
[testf2py]$ python setup.py bdist_egg
running bdist_egg
running egg_info
creating subr.egg-info


zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/subr-0.0.0-py2.4-macosx-10.4-ppc.egg' and adding
'build/bdist.darwin-8.3.0-Power_Macintosh/egg' to it
removing 'build/bdist.darwin-8.3.0-Power_Macintosh/egg' (and everything under it)
[testf2py]$ easy_install dist/subr-0.0.0-py2.4-macosx-10.4-ppc.egg
Processing subr-0.0.0-py2.4-macosx-10.4-ppc.egg
Copying subr-0.0.0-py2.4-macosx-10.4-ppc.egg to
Adding subr 0.0.0 to easy-install.pth file

Processing dependencies for subr==0.0.0
Searching for DoesNotExist
Reading http://www.python.org/pypi/DoesNotExist/
Couldn't find index page for 'DoesNotExist' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://www.python.org/pypi/

Robert Kern
robert.kern at gmail.com

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter

More information about the Scipy-dev mailing list