[Numpy-discussion] "import numpy" is slow

Gael Varoquaux gael.varoquaux@normalesup....
Fri Aug 1 11:53:51 CDT 2008

On Fri, Aug 01, 2008 at 09:18:48AM -0700, Christopher Barker wrote:
> > What does python -c "import sys; print sys.path" say ?

> A lot! 41 entries, and lot's of eggs -- are eggs an issue? I'm also 
> wondering how the order is determined -- if it looked in site-packages 
> first, it would find numpy a whole lot faster.

AFAIK this is a setuptools issue. From what I hear, it might be fixed in
the svn version of setuptools, but they still have to make a release that
has this feature.

The two issues I can see are: import path priority, it should be screwed
up like it is, and speed. Speed is obviously a hard problem.

> I suspect the thing to do is to re-install from scratch, and only add in 
> packages I'm really using now.

Avoid eggs if you can. This has been my policy. I am not sure how much
this is just superstition or a real problem, though.

I realize that you are on mac, and that mac unlike some distribution of
linux does not have a good dependency tracking system. Thus seutptools
and eggs are a great tentation. Them come to a cost, but it can probably
be improved. If you care about this problem, you could try and work with
the setuptools developers to improve the situation. I must say that I am
under UBuntu, and I don't have the dependency problem at all, so
setuptools does not answer an important need for me. I however realize
that not everybody wants to use Ubuntu and I thus care about the problem,
maybe not enough to invest much time in setuptools, but at least enough
to try to report problems and track solution. Do not underestimate how
difficult it is to get a package-manager that works well.

If you ever do verify that it is indeed eggs that I slowing down your
import, I'd be interested in having the confirmation, just so that I am
sure I am not blaming them for nothing.



More information about the Numpy-discussion mailing list