<p dir="auto"><strong>System information</strong></p>
<ul dir="auto">
<li>OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04</li>
<li>Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:</li>
<li>TensorFlow installed from (source or binary): 1.12.0</li>
<li>TensorFlow version: 1.12.0</li>
<li>Python version: 3.6</li>
<li>Installed using virtualenv? pip? conda?: conda</li>
<li>Bazel version (if compiling from source): 0.22.0</li>
<li>GCC/Compiler version (if compiling from source): 5.4.0</li>
<li>CUDA/cuDNN version: cuda=10.0/cudnn=7.4.2</li>
<li>GPU model and memory: RTX 2080</li>
</ul>
<p dir="auto"><strong>Describe the problem</strong></p>
<p dir="auto">I installed the everything and ran the tests for cuda and cudnn that were said from and they both passed normally. Running small tests with tensorflow also worked, i.e. a linear regression model. However, I was trying to run a file using keras and doing a more complicated <a href="https://github.com/tensorflow/models/tree/master/samples/outreach/blogs/segmentation_blogpost">model</a> and it threw errors when it started running an individual epoch. I also just ran the code with only a small portion of the images.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="I tensorflow/stream_executor/platform/default/dso_loader.cc:161] successfully opened CUDA library libcudnn.so.7 locally
E tensorflow/stream_executor/cuda/cuda_dnn.cc:482] Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR
E tensorflow/stream_executor/cuda/cuda_dnn.cc:482] Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR

...
...

tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
	 [[{{node conv2d/Conv2D}}]]
	 [[conv2d_transpose_2/Shape/_1171]]"><pre class="notranslate"><code class="notranslate">I tensorflow/stream_executor/platform/default/dso_loader.cc:161] successfully opened CUDA library libcudnn.so.7 locally
E tensorflow/stream_executor/cuda/cuda_dnn.cc:482] Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR
E tensorflow/stream_executor/cuda/cuda_dnn.cc:482] Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR

...
...

tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
	 [[{{node conv2d/Conv2D}}]]
	 [[conv2d_transpose_2/Shape/_1171]]
</code></pre></div>
<p dir="auto">Running the code normally with tensorflow works fine, only the gpu version is failing. I tried both building it from source and using tf-nightly-gpu.</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>: Linux Ubuntu 16.04</li>
<li><strong>TensorFlow installed from (source or binary)</strong>: source</li>
<li><strong>TensorFlow version (use command below)</strong>: 1.8.0</li>
<li><strong>Python version</strong>: 3.5</li>
<li><strong>Bazel version (if compiling from source)</strong>: 0.14.1</li>
<li><strong>GCC/Compiler version (if compiling from source)</strong>: 5.4.0</li>
<li><strong>CUDA/cuDNN version</strong>: 9.0</li>
<li><strong>GPU model and memory</strong>: Tesla K40c,  11440 MBytes</li>
<li><strong>Exact command to reproduce</strong>: see below</li>
</ul>
<h3 dir="auto">Describe the problem</h3>
<p dir="auto">I want the embedded python in my C++ code to import tensorflow, but the line "import tensorflow" gives an error at run time. That's no happening while importing other python modules. There is no problem with using tensorflow from my python shell/scripts, I can also compile and use custom ops written in C++, so that proofs that the installation worked without problems. I don't know if it's relevant, but my C++ library already uses tensorflow as third part shared library.</p>
<p dir="auto">Here my very easy C++ code that calls python:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="        PyObject* pInt;

        Py_Initialize();

        PyRun_SimpleString(&quot;import tensorflow \n&quot;
                           &quot;print('Hello TF!!!')&quot;);

        Py_Finalize();"><pre class="notranslate"><code class="notranslate">        PyObject* pInt;

        Py_Initialize();

        PyRun_SimpleString("import tensorflow \n"
                           "print('Hello TF!!!')");

        Py_Finalize();
</code></pre></div>
<p dir="auto">Here is the error I get at runtime:</p>
<p dir="auto">Traceback (most recent call last):<br>
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <br>
from tensorflow.python.pywrap_tensorflow_internal import *<br>
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <br>
_pywrap_tensorflow_internal = swig_import_helper()<br>
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper<br>
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)<br>
File "/usr/lib/python3.5/imp.py", line 242, in load_module<br>
return load_dynamic(name, filename, file)<br>
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic<br>
return _load(spec)<br>
ImportError: /usr/local/lib/python3.5/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZNK6google8protobuf7Message11GetTypeNameEv</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 1, in <br>
File "/usr/local/lib/python3.5/dist-packages/tensorflow/<strong>init</strong>.py", line 24, in <br>
from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import<br>
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/<strong>init</strong>.py", line 49, in <br>
from tensorflow.python import pywrap_tensorflow<br>
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <br>
raise ImportError(msg)<br>
ImportError: Traceback (most recent call last):<br>
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <br>
from tensorflow.python.pywrap_tensorflow_internal import *<br>
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <br>
_pywrap_tensorflow_internal = swig_import_helper()<br>
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper<br>
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)<br>
File "/usr/lib/python3.5/imp.py", line 242, in load_module<br>
return load_dynamic(name, filename, file)<br>
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic<br>
return _load(spec)<br>
ImportError: /usr/local/lib/python3.5/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: _ZNK6google8protobuf7Message11GetTypeNameEv</p>
<p dir="auto">Failed to load the native TensorFlow runtime.</p>
<p dir="auto">See <a href="https://www.tensorflow.org/install/install_sources#common_installation_problems" rel="nofollow">https://www.tensorflow.org/install/install_sources#common_installation_problems</a></p>
<p dir="auto">for some common reasons and solutions.  Include the entire stack trace<br>
above this error message when asking for help.</p>