I can't include numpy in my app, py2exe is refusing to load it correctly.  I'm using Python 2.5 and the Numpy 1.3.0 "superpack" under Windows.  When I run the script below (the referenced "cli.py" is empty) I get:

ImportError: No module named numpy.distutils.tests

Technically that's true; numpy.distutils.tests is actually a package.  And if you examine the setup.py, you'll see that exact package listed under excludes.

Why is py2exe loading that package incorrectly, and why is it ignoring my excludes?


import  distutils.core
import  os
import  py2exe
import  sys

def build_windist():
    windows_opts = [{
          "script": "cli.py",

    setup_opts = {
        "py2exe": {
            "packages": [
            "excludes": [

        options = setup_opts,
        console = windows_opts,

if __name__ == '__main__':
    print "\n".join(sorted(sys.path))
    # If run without args, build executable in quiet mode.
    if len(sys.argv) == 1:
        sys.argv = [sys.argv[0], "py2exe", "-q"]