[SciPy-user] Bundling numpy/scipy with applications

Fernando Perez fperez.net at gmail.com
Sat Dec 29 22:08:55 EST 2007


On Nov 13, 2007 12:35 AM, David Cournapeau <david at ar.media.kyoto-u.ac.jp> wrote:
> Johann Cohen-Tanugi wrote:
> >
> > do make install in platform/numpy fails exactly in the same way :
> I  forgot to tell you to do make clean before, otherwise, it indeed has
> no way to fail in a different way :)
>
> > [cohen at localhost numpy]$ make install
> > [===== NOW BUILDING:    numpy-1.0.3.1   =====]
> >         [fetch] complete for numpy.
> >         [checksum] complete for numpy.
> >         [extract] complete for numpy.
> >         [patch] complete for numpy.
> > # Change default path when looking for libs to fake dir,
> > # so we can set everything by env variables
> > cd work/main.d/numpy-1.0.3.1 &&
> > PYTHONPATH=/home/cohen/garnumpyinstall/lib/python2.5/site-packages:/home/cohen/garnumpyinstall/lib/python2.5/site-packages/gtk-2.0
> > /usr/bin/python \
> >         setup.py config_fc --fcompiler=gnu config
> > Traceback (most recent call last):
> >   File "setup.py", line 90, in <module>
> >     setup_package()
> >   File "setup.py", line 60, in setup_package
> >     from numpy.distutils.core import setup
> >   File
> > "/data1/sources/python/garnumpy-0.4/platform/numpy/work/main.d/numpy-1.0.3.1/numpy/__init__.py",
> > line 39, in <module>
> >     import core
> >   File
> > "/data1/sources/python/garnumpy-0.4/platform/numpy/work/main.d/numpy-1.0.3.1/numpy/core/__init__.py",
> > line 8, in <module>
> >     import numerictypes as nt
> >   File
> > "/data1/sources/python/garnumpy-0.4/platform/numpy/work/main.d/numpy-1.0.3.1/numpy/core/numerictypes.py",
> > line 83, in <module>
> >     from numpy.core.multiarray import typeinfo, ndarray, array, empty, dtype
> > ImportError: No module named multiarray
> I really don't understand this error: you are configuring numpy for
> compilation, so it should not try to import numpy.core (which has no way
> to succeed since it is not built yet). IOW, it is a bootstrap error
> (numpy build system tries to import numpy).

We finally tracked this down to a system-wide numpy confusing the
brittle hack that __init__ was using to detect being run from the
source directory.

This commit:

http://projects.scipy.org/scipy/numpy/changeset/4663

Fixes it and allows you to do an in-place build of numpy via

python setup.py build_src --inplace
python setup.py build_ext --inplace

for development.

It's a bit of an ugly hack, but at least it works robustly and avoids
the problem above (which bit me today).

Please let me know if the approach in the patch causes problems for
any other types of usage.

Cheers,

f



More information about the SciPy-User mailing list