From: Francesc A. <fa...@ca...> - 2006-10-13 14:09:11
|
Hi, Is it possible to test a numpy version directly from the source directory without having to install it? I mean, if I compile the sources and try to use the package directly from there, I get unexpected results. For example: $ export PYTHONPATH=3D/home/faltet/python.nobackup/numpy/trunk $ python2.4 -c "import numpy;print numpy.dtype([('col1', '(1,)i4')])" Running from numpy source directory. Traceback (most recent call last): File "<string>", line 1, in ? AttributeError: 'module' object has no attribute 'dtype' It would be nice to have a way of testing a recently built version of numpy prior to install it. Thanks, --=20 >0,0< Francesc Altet http://www.carabos.com/ V V C=C3=A1rabos Coop. V. Enjoy Data "-" "Be careful about using the following code -- I've only proven that it works, I haven't tested it." -- Donald Knuth |
From: Lisandro D. <da...@gm...> - 2006-10-13 20:20:51
|
On 10/13/06, Francesc Altet <fa...@ca...> 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=3D/tmp $ export PYTHONPATH=3D/tmp/lib/python and then $ python -c 'import numpy; numpy.test()' and finally, if all was right, su -c 'python setup.py install' or python setup.py install --home=3D$HOME --=20 Lisandro Dalc=EDn --------------- Centro Internacional de M=E9todos Computacionales en Ingenier=EDa (CIMEC) Instituto de Desarrollo Tecnol=F3gico para la Industria Qu=EDmica (INTEC) Consejo Nacional de Investigaciones Cient=EDficas y T=E9cnicas (CONICET) PTLC - G=FCemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 |
From: Francesc A. <fa...@ca...> - 2006-10-17 08:03:25
|
A Divendres 13 Octubre 2006 22:20, Lisandro Dalcin va escriure: > On 10/13/06, Francesc Altet <fa...@ca...> 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=3D/tmp > $ export PYTHONPATH=3D/tmp/lib/python Thanks for your answer Lisandro, but what I want is to completely avoid an= =20 installation. The idea is to be able to test the local copy version of nump= y=20 in the development directory while doing small changes on it. Having to do= =20 the install step slows down the testing phase when doing small changes. Cheers, =2D-=20 >0,0< Francesc Altet =A0 =A0 http://www.carabos.com/ V V C=E1rabos Coop. V. =A0=A0Enjoy Data "-" |
From: Stefan v. d. W. <st...@su...> - 2006-10-17 08:22:36
|
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 <fa...@ca...> 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=3D/tmp > > $ export PYTHONPATH=3D/tmp/lib/python >=20 > Thanks for your answer Lisandro, but what I want is to completely avoid= an=20 > installation. The idea is to be able to test the local copy version of = numpy=20 > in the development directory while doing small changes on it. Having to= do=20 > 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 =3D 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=E9fan |
From: <pe...@ce...> - 2006-10-17 11:04:22
|
On Tue, 17 Oct 2006, Stefan van der Walt wrote: > 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 <fa...@ca...> 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? Actually numpy.distutils supports in place builds of C modules. However, its rather difficult to make numpy inplace to work for the following reasons: - to build a numpy based C extension, you'll need numpy header files - numpy header files are generated during numpy build So it is a chicken-egg problem. One workaround for testing a numpy subpackage would be installing numpy and then doing inplace build in numpy subpackage directory. For example: cd svn/numpy python setup.py install cd numpy/fft python setup.py build build_ext --inplace Another workaround would be to install only numpy.core (that contains numpy headers) and then doing inplace builds in numpy source directory --- this, however, requires some setup.py modifications. IMO, doing inplace builds has side effects that can easily lead to shooting to a leg. While developing numpy, I would recommend always installing numpy to some place, setting PYTHONPATH accordingly, write unittests, and run them for testing. When test_*.py files are set up properly then you don't need to install everytime you modify unittests, they can be run inplace. Pearu |