title: How to use Numba extension in setup.py?
body: <p>I try to use the Numba for some fast calculations. I got the following issue while creating a package that use a Numba extension.</p>
  <p>I did similar things as suggested on the official <a href="http://numba.pydata.org/numba-doc/latest/user/pycc.html" rel="nofollow noreferrer">website</a>. I have the following folder structure:</p>
  <pre><code>-test_numba
    -test_numba
      -__init__.py
      -source_module.py
  -setup.py
  </code></pre>
  <p>Then I put the following code in source_module.py:</p>
  <pre class="lang-py prettyprint-override"><code>from numba.pycc import CC
  
  cc = CC('my_module')
  cc.verbose = True
  
  @cc.export('multf', 'f8(f8, f8)')
  @cc.export('multi', 'i4(i4, i4)')
  def mult(a, b):
      return a * b
  
  @cc.export('square', 'f8(f8)')
  def square(a):
      return a ** 2
  
  if __name__ == &quot;__main__&quot;:
      cc.compile()
  </code></pre>
  <p>And complied it. and for <strong>init</strong>.py, I simply import the functions:</p>
  <pre class="lang-py prettyprint-override"><code>from .my_module import *
  </code></pre>
  <p>and for setup.py:</p>
  <pre class="lang-py prettyprint-override"><code>from setuptools import setup
  from test_numba.source_module import cc
  from setuptools import Extension
  
  if __name__ == &quot;__main__&quot;:
      setup(
          name=&quot;test_numba&quot;,
          version=&quot;0.0.1&quot;,
          packages=[&quot;test_numba&quot;],
          ext_modules=[cc.distutils_extension()]
      )
  </code></pre>
  <p>I used pip install to installed the package. but the extension is not installed in the correct folder location.</p>
  <pre><code>    /Users/xxx/miniconda3/envs/py/lib/python3.7/site-packages/my_module.cpython-37m-darwin.so
      /Users/xxx/miniconda3/envs/py/lib/python3.7/site-packages/test_numba-0.0.1.dist-info/*
      /Users/xxx/miniconda3/envs/py/lib/python3.7/site-packages/test_numba/*
  </code></pre>
  <p>and when I try to import this package from jupyter. I will get the following error: <em>No module named 'test_numba.my_module'</em></p>
  <p>How to correct this?</p>