[Numpy-discussion] "import numpy" is slow
David Cournapeau
cournapeau at cslab.kecl.ntt.co.jp
Wed Jul 30 21:53:52 EDT 2008
On Thu, 2008-07-31 at 02:07 +0200, Andrew Dalke wrote:
> On Jul 30, 2008, at 10:59 PM, Stéfan van der Walt wrote:
> > I.e. most people don't start up NumPy all the time -- they import
> > NumPy, and then do some calculations, which typically take longer than
> > the import time.
>
> Is that interactively, or is that through programs?
Most people use it interactively, or for long running programs. Import
times only matters for interactive commands depending on numpy.
>
> and I am not saying to change this code. Instead, I am asking for
> limits on the eagerness, with a long-term goal of minimizing its use.
For new API, this is never done, and is a bug if it is. In scipy,
typically, import scipy does not import the whole subpackages list.
> I also haven't yet figured out how to get the regression tests to
> run, and I'm not going to contribute patches without at least passing
> that bare minimum. BTW, how do I do that? In the top-level there's
> a 'test.sh' command but when I run it I get:
Argh, this file should have never ended here, that's entirely my fault.
It was a merge from a (at the time) experimental branch. I can't remove
it now because my company does not allow subversion access, but I will
fix this tonight. Sorry for the confusion.
>
> and when I run 'nosetests' in the top-level directory I get:
>
> ImportError: Error importing numpy: you should not try to import
> numpy from
> its source directory; please exit the numpy source tree, and
> relaunch
> your python intepreter from there.
>
> I couldn't find (in a cursory search) instructions for running self-
> tests or regression tests.
You are supposed to run the tests on an installed numpy, not in the
sources:
import numpy
numpy.test(verbose = 10)
You can't really use run numpy without it to be installed first (which
is what the message is about).
cheers,
David
More information about the NumPy-Discussion
mailing list