title: AttributeError in Py2exe
body: <p>I made my <code>py</code> file executable using <code>py2exe</code>. My <code>setup.py</code> is as follows:</p>
  
  <pre><code>from distutils.core import setup
  import py2exe
  
  setup(windows=['main.py'])
  </code></pre>
  
  <p>When I tried to run <code>main.exe</code>, I get an error and was referred to <code>main.log</code> which reads:</p>
  
  <pre><code>Traceback (most recent call last):
    File "main.py", line 20, in &lt;module&gt;
    File "&lt;frozen importlib._bootstrap&gt;", line 2237, in _find_and_load
    File "&lt;frozen importlib._bootstrap&gt;", line 2226, in _find_and_load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1191, in _load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1161, in _load_backward_compatible
    File "C:\Python34\lib\site-packages\pandas\__init__.py", line 7, in &lt;module&gt;
      from . import hashtable, tslib, lib
    File "&lt;frozen importlib._bootstrap&gt;", line 2237, in _find_and_load
    File "&lt;frozen importlib._bootstrap&gt;", line 2226, in _find_and_load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1191, in _load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1161, in _load_backward_compatible
    File "&lt;loader&gt;", line 10, in &lt;module&gt;
    File "&lt;loader&gt;", line 6, in __load
    File "pandas\tslib.pyx", line 2839, in init pandas.tslib (pandas\tslib.c:79846)
    File "&lt;frozen importlib._bootstrap&gt;", line 2237, in _find_and_load
    File "&lt;frozen importlib._bootstrap&gt;", line 2226, in _find_and_load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1191, in _load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1161, in _load_backward_compatible
    File "&lt;loader&gt;", line 10, in &lt;module&gt;
    File "&lt;loader&gt;", line 6, in __load
    File "pandas\algos.pyx", line 64, in init pandas.algos (pandas\algos.c:179610)
    File "&lt;frozen importlib._bootstrap&gt;", line 2237, in _find_and_load
    File "&lt;frozen importlib._bootstrap&gt;", line 2226, in _find_and_load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1191, in _load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1161, in _load_backward_compatible
    File "&lt;loader&gt;", line 10, in &lt;module&gt;
    File "&lt;loader&gt;", line 6, in __load
    File "pandas\lib.pyx", line 1, in init pandas.lib (pandas\lib.c:77889)
  AttributeError: 'module' object has no attribute '__pyx_capi__'
  </code></pre>
  
  <p>It looks like line 20 in my <code>main.py</code> file (<code>import pandas as pd</code>) triggered the problem. This type of error is referenced in a pull request <a href="https://bitbucket.org/khinsen/mmtk/pull-request/6/add-__init__-file-for-cython/diff#chg-Src/MMTK/__init__.py" rel="nofollow noreferrer">here</a> and they suggested adding a blank <code>__init__.py</code> file. I did so and got same result. I found a well commented post <a href="https://stackoverflow.com/questions/1250103/attributeerror-module-object-has-no-attribute">here</a> (not directly dealing with py2exe) that suggests this might be due to mutual top-level imports or circular dependencies. This problem seems well known and has been mentioned at least twice on Stackoverflow in the past year (e.gs: <a href="https://stackoverflow.com/questions/15752652/py2exe-python24-numpy-error-attributeerror-dtype">here</a> and <a href="https://stackoverflow.com/questions/24973913/how-can-i-import-python-libraries-with-pyx-and-c-files-without-installing-on-t">here</a>) but no clear solution has been given. </p>
  
  <p>Perhaps we can get more clarity now with your feedback. </p>
  
  <p><strong>Python 3.4.2; py2exe 0.9.2.0</strong></p>