<h3 dir="auto">System information</h3>
<ul dir="auto">
<li><strong>script provided in TensorFlow :  import tensorflow as tf</strong>.</li>
<li><strong>OS Platform and Distribution Windows 7 64 bits</strong>:</li>
<li><strong>TensorFlow installed from binary</strong>:</li>
<li><strong>TensorFlow version 1.6</strong>:</li>
<li><strong>Python 3.6</strong>:</li>
<li><strong>Bazel version : no bazel</strong>:</li>
<li><strong>GCC/Compiler version : no compiler</strong>:</li>
<li><strong>CUDA/cuDNN version : CPU, not GPU</strong>:</li>
<li><strong>GPU model and memory: no GPU</strong>:</li>
<li><strong>compiling a python program with Pycharm</strong>:</li>
</ul>
<h3 dir="auto">Describe the problem</h3>
<p dir="auto">I got a bug when using Version 1.6.<br>
Version 1.5 works fine on the same environment. But I need version Tensorflow 1.6 to run Mozilla's deepspeech tool.</p>
<h3 dir="auto">Source code / logs</h3>
<p dir="auto">Traceback (most recent call last):<br>
File "C:\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper<br>
return importlib.import_module(mname)<br>
File "C:\Python36\lib\importlib_<em>init</em>_.py", line 126, in import_module<br>
return _bootstrap._gcd_import(name[level:], package, level)<br>
File "", line 994, in _gcd_import<br>
File "", line 971, in _find_and_load<br>
File "", line 955, in _find_and_load_unlocked<br>
File "", line 658, in _load_unlocked<br>
File "", line 571, in module_from_spec<br>
File "", line 922, in create_module<br>
File "", line 219, in _call_with_frames_removed<br>
ImportError: DLL load failed with error code -1073741795</p>
<p dir="auto">During handling of the above exception, another exception occurred:</p>
<p dir="auto">Traceback (most recent call last):<br>
File "C:\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <br>
from tensorflow.python.pywrap_tensorflow_internal import *<br>
File "C:\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <br>
_pywrap_tensorflow_internal = swig_import_helper()<br>
File "C:\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper<br>
return importlib.import_module('<em>pywrap_tensorflow_internal')<br>
File "C:\Python36\lib\importlib_<em>init</em></em>.py", line 126, in import_module<br>
return _bootstrap._gcd_import(name[level:], package, level)<br>
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'</p>
<p dir="auto">During handling of the above exception, another exception occurred:</p>
<p dir="auto">Traceback (most recent call last):<br>
File "", line 566, in run_nodebug<br>
File "", line 1, in <br>
File "C:\Python36\lib\site-packages\tensorflow_<em>init</em>_.py", line 24, in <br>
from tensorflow.python import *<br>
File "C:\Python36\lib\site-packages\tensorflow\python_<em>init</em>_.py", line 49, in <br>
from tensorflow.python import pywrap_tensorflow<br>
File "C:\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <br>
raise ImportError(msg)<br>
ImportError: Traceback (most recent call last):<br>
File "C:\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper<br>
return importlib.import_module(mname)<br>
File "C:\Python36\lib\importlib_<em>init</em>_.py", line 126, in import_module<br>
return _bootstrap._gcd_import(name[level:], package, level)<br>
File "", line 994, in _gcd_import<br>
File "", line 971, in _find_and_load<br>
File "", line 955, in _find_and_load_unlocked<br>
File "", line 658, in _load_unlocked<br>
File "", line 571, in module_from_spec<br>
File "", line 922, in create_module<br>
File "", line 219, in _call_with_frames_removed<br>
ImportError: DLL load failed with error code -1073741795</p>
<p dir="auto">During handling of the above exception, another exception occurred:</p>
<p dir="auto">Traceback (most recent call last):<br>
File "C:\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <br>
from tensorflow.python.pywrap_tensorflow_internal import *<br>
File "C:\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <br>
_pywrap_tensorflow_internal = swig_import_helper()<br>
File "C:\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper<br>
return importlib.import_module('<em>pywrap_tensorflow_internal')<br>
File "C:\Python36\lib\importlib_<em>init</em></em>.py", line 126, in import_module<br>
return _bootstrap._gcd_import(name[level:], package, level)<br>
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'</p>
<h3 dir="auto">System information</h3>
<ul dir="auto">
<li><strong>Have I written custom code (as opposed to using a stock example script provided in TensorFlow)</strong>: Yes</li>
<li><strong>OS Platform and Distribution (e.g., Linux Ubuntu 16.04)</strong>: Windows 10 server in desktop mode</li>
<li><strong>Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device</strong>: NA</li>
<li><strong>TensorFlow installed from (source or binary)</strong>: binary</li>
<li><strong>TensorFlow version (use command below)</strong>: tensorflow-gpu 1.10.0</li>
<li><strong>Python version</strong>: Anaconda x64 3.6</li>
<li><strong>Bazel version (if compiling from source)</strong>: NA</li>
<li><strong>GCC/Compiler version (if compiling from source)</strong>: NA</li>
<li><strong>CUDA/cuDNN version</strong>: 9.0/7.0</li>
<li><strong>GPU model and memory</strong>: Q4000</li>
<li><strong>Exact command to reproduce</strong>: N/A</li>
</ul>
<h3 dir="auto">Describe the problem</h3>
<ol dir="auto">
<li>Create a python application that imports tensorflow-gpu</li>
<li>Package the application with pyinstaller</li>
<li>Start the generated executable, that crashes while trying to import tensorflow.</li>
</ol>
<p dir="auto">The error trace is this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;site-packages\tensorflow\python\pywrap_tensorflow.py&quot;, line 58, in &lt;module&gt;
  File &quot;c:\users\paperspace\.virtualenvs\***-ecouzwts\lib\site-packages\PyInstaller\loader\pyimod03_importers.py&quot;, line 627, in exec_module
    exec(bytecode, module.__dict__)
  File &quot;site-packages\tensorflow\python\pywrap_tensorflow_internal.py&quot;, line 18, in &lt;module&gt;
  File &quot;site-packages\tensorflow\python\pywrap_tensorflow_internal.py&quot;, line 17, in swig_import_helper
  File &quot;importlib\__init__.py&quot;, line 126, in import_module
ModuleNotFoundError: No module named 'tensorflow.python._pywrap_tensorflow_internal'


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help."><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in &lt;module&gt;
  File "c:\users\paperspace\.virtualenvs\***-ecouzwts\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in &lt;module&gt;
  File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper
  File "importlib\__init__.py", line 126, in import_module
ModuleNotFoundError: No module named 'tensorflow.python._pywrap_tensorflow_internal'


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
</code></pre></div>
<p dir="auto">On the other hand, <strong>doing the same process with tensorflow(-cpu) works fine</strong>.</p>
<p dir="auto">I ruled out CUDA/cuDNN installation issue, because if I run my python application using python, it works fine with the GPU version.</p>
<p dir="auto">I have tried checking at the .exe with dependency_walker, but appart from false-positive missing <code class="notranslate">API-MS-*</code> and <code class="notranslate">EXT-MS-*</code> DLLs, I don't see anything obvious.</p>
<p dir="auto">So I'm stuck here.<br>
What discrepancy could create an import issue with tensorflow-gpu and not with tensorflow-cpu ?</p>