title: Numpy Pyinstaller ImportError: cannot import name multiarray
body: <p>I'm encountering a similar problem to the one reported <a href="https://stackoverflow.com/questions/25701821/after-upgrading-to-numpy-1-8-2-importerror-cannot-import-name-multiarray">here</a>, which seems to be a an unresolved issue.</p>
  
  <p>After compiling an exe, a pyinstaller build throws the following error, which is likely caused by the numpy\core\ init.py</p>
  
  <p>There are some <a href="https://stackoverflow.com/questions/21324426/numpy-build-fails-with-cannot-import-multiarray">suggestions</a> that it has to do with conflicting numpy installations however I have uninstalled and re-installed several times and searched for any other installations without luck.
  Currently running with numpy-1.9+MKL binaries. </p>
  
  <p>I have also flagged the multiarray.pyd file into the spec file as a binary to grab. No luck.</p>
  
  <p>No idea what is causing this as I'm not particularly familiar with the init file structure. Any idea how to get this imported?</p>
  
  <p>Traceback of the error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;string&gt;", line 50, in &lt;module&gt;
    File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
      exec(bytecode, module.__dict__)
    File "C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\out00-PYZ.pyz\mpl_toolkits.basemap", line 15, in &lt;module&gt;
    File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
      exec(bytecode, module.__dict__)
    File "C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\out00-PYZ.pyz\matplotlib", line 133, in &lt;module&gt;
    File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
      exec(bytecode, module.__dict__)
    File "C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\out00-PYZ.pyz\matplotlib.rcsetup", line 19, in &lt;module&gt;
    File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
      exec(bytecode, module.__dict__)
    File "C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\out00-PYZ.pyz\matplotlib.colors", line 52, in &lt;module&gt;
    File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
      exec(bytecode, module.__dict__)
    File "C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\out00-PYZ.pyz\numpy", line 200, in &lt;module&gt;
    File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
      exec(bytecode, module.__dict__)
    File "C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\out00-PYZ.pyz\numpy.add_newdocs", line 13, in &lt;module&gt;
    File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
      exec(bytecode, module.__dict__)
    File "C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\out00-PYZ.pyz\numpy.lib", line 8, in &lt;module&gt;
    File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
      exec(bytecode, module.__dict__)
    File "C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\out00-PYZ.pyz\numpy.lib.type_check", line 11, in &lt;module&gt;
    File "C:\Python27\Lib\site-packages\PyInstaller\loader\pyi_importers.py", line 270, in load_module
      exec(bytecode, module.__dict__)
    File "C:\Users\Hp\PycharmProjects\GISdev\build\gis_helper2\out00-PYZ.pyz\numpy.core", line 14, in &lt;module&gt;
  ImportError: cannot import name multiarray
  </code></pre>
  
  <p>Possible cause of the problem taken from the init file:</p>
  
  <pre><code>from __future__ import division, absolute_import, print_function
  
  from .info import __doc__
  from numpy.version import version as __version__
  
  # disables OpenBLAS affinity setting of the main thread that limits
  # python threads or processes to one core
  import os
  envbak = os.environ.copy()
  if 'OPENBLAS_MAIN_FREE' not in os.environ:
      os.environ['OPENBLAS_MAIN_FREE'] = '1'
  if 'GOTOBLAS_MAIN_FREE' not in os.environ:
      os.environ['GOTOBLAS_MAIN_FREE'] = '1'
  from . import multiarray
  os.environ.clear()
  os.environ.update(envbak)
  del envbak
  del os
  
  from . import umath
  from . import _internal  # for freeze programs
  from . import numerictypes as nt
  multiarray.set_typeDict(nt.sctypeDict)
  </code></pre>