title: Python PyInstaller 4.0 packaging TensorFlow 2.0 project not working ImportError: cannot import name 'pywrap_tensorflow'
body: <p>I am trying to bundle a python application using pyinstaller that uses tensorflow.</p>
  
  <p>I am now using Pyinstaller-4.0.dev0+2f4426f52, Tensorflow 2.0, Keras 2.3 and Python 3.7.3 all in a virtual environment.</p>
  
  <p>I have tried various older versions, but each older version had a different issue that I could not resolve. I have dedicated 3 days to trying to solve this problem.</p>
  
  <p>A simplified example of the script I am running is:</p>
  
  <pre><code>from tensorflow import keras
  model = keras.Sequential()
  </code></pre>
  
  <p>I used the following command to run pyinstaller:</p>
  
  <pre><code>pyinstaller --noconfirm --log-level=DEBUG ^
      --onedir ^
      --clean ^
      --name MyModel ^
      --hidden-import=tensorflow_core ^
      --noupx ^
      main.py
  </code></pre>
  
  <p>Using hidden-import appears to be redundant, as the output states:</p>
  
  <blockquote>
    <p>DEBUG: Hidden import 'tensorflow_core' already found</p>
  </blockquote>
  
  <p>There were no build errors or warnings in the log.</p>
  
  <p>I have looked into the pyz-00.pyz file and can confirm that TensorFlow modules are included in the file. I confirmed that the archive contains:</p>
  
  <blockquote>
    <p>'tensorflow_core.python': (1, 9871434, 2355),</p>
  </blockquote>
  
  <p>However when I try to run the exe I get the following error:</p>
  
  <blockquote>
    <p>File "site-packages\tensorflow_core\python_init_.py", line 49, in
    ImportError: cannot import name 'pywrap_tensorflow' from
    'tensorflow_core.python'
    (\dist\MyModel\tensorflow_core\python_init_.pyc)</p>
  </blockquote>
  
  <p>It appears that pyinstaller can't deal with tensorflow, and I wondered whether anyone with experience here might know how to write a hook for it or knows of some other workaround?</p>