[Numpy-discussion] "import numpy" is slow

Christopher Barker Chris.Barker at noaa.gov
Thu Jul 31 12:45:35 EDT 2008


Andrew Dalke wrote:
> If I had my way, remove things like (in numpy/__init__.py)
> 
>      import linalg
>      import fft
>      import random
>      import ctypeslib
>      import ma

as a side benefit, this might help folks using py2exe, py2app and 
friends -- as it stands all those sub-modules need to be included in 
your app bundle regardless of whether they are used.

I recall having to explicitly add them by hand, too, though that may 
have been a matplotlib.numerix issue.

> but leave the list of submodules in "__all__" so that "from numpy  
> import *" works.

Of course, no one should be doing that anyway.... ;-)

And for what it's worth, I've found myself very frustrated by how long 
it takes to start up python and import numpy. I often do whip out the 
interpreter to do something fast, and I didn't used to have to wait for  it.

On my OS-X box (10.4.11, python2.5, numpy '1.1.1rc2'), it takes about 7 
seconds to import numpy!

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov



More information about the NumPy-Discussion mailing list