Testing numpy without doing an installation?

Stefan van der Walt stefan at sun.ac.za
Tue Oct 17 03:22:02 CDT 2006


On Tue, Oct 17, 2006 at 10:03:03AM +0200, Francesc Altet wrote:
> A Divendres 13 Octubre 2006 22:20, Lisandro Dalcin va escriure:
> > On 10/13/06, Francesc Altet <faltet at carabos.com> wrote:
> > > Is it possible to test a numpy version directly from the source
> > > directory without having to install it?
> >
> > I usually do:
> >
> > $ python setup.py build
> > $ python setup.py install --home=/tmp
> > $ export PYTHONPATH=/tmp/lib/python
> 
> Thanks for your answer Lisandro, but what I want is to completely avoid an 
> installation. The idea is to be able to test the local copy version of numpy 
> in the development directory while doing small changes on it. Having to do 
> the install step slows down the testing phase when doing small
> changes.

It would be great if we could get this to work.  One problem is that
distutils won't build the C-modules in place.  Does anyone know of a
workaround?

At the moment, if you run numpy from the source directory, you see the
message

In [1]: import numpy
Running from numpy source directory.

after which you can't access any of the numpy functions.  This would
be due to this snippet in __init__.py:

try:
    from __config__ import show as show_config
except ImportError:
    show_config = None

if show_config is None:
    import sys as _sys
    print >> _sys.stderr, 'Running from numpy source directory.'
    del _sys

If we declare set_package_path and restore_path in __init__.py, we can
wrap all imports in numpy with

set_package_path('../../..') # set path back required depth
from numpy import whatever, you, need
restore_path()

That would take care of things on the python side, at least.

Cheers
Stéfan

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Numpy-discussion mailing list