[Numpy-discussion] "import numpy" is slow

David Cournapeau david at ar.media.kyoto-u.ac.jp
Sat Aug 2 01:06:18 EDT 2008


Christopher Barker wrote:
>
> OK, I just installed wxPython, and whoa!
>
> time python -c "import numpy"
>
> real    0m2.793s
> user    0m0.294s
> sys     0m2.494s
>
> so it's taking almost two seconds more to import numpy, now that 
> wxPython is installed. I haven't even imported it yet. importing wx 
> isn't as bad:
>
> $ time python -c "import wx"
>
> real    0m1.589s
> user    0m0.274s
> sys     0m1.000s
>
>   

Since numpy  wo wx + wc import times adds up to numpy import times, this
suggests that numpy may import wx. Which it shouldn't, obviously. There
is something strange happening here. Please check wether wx really is
imported when you do import numpy:

python -c "import numpy; import sys; print sys.modules"

And if it is, we have to know why it is imported at all when doing
import numpy.

cheers,

David



More information about the NumPy-Discussion mailing list