aeid
aeid

Reputation: 41

undefined symbol: cuDevicePrimaryCtxGetState when importing tensorflow

everyone!

I'm trying to install and run tensorflow (GPU-support). I followed the guide and installed cudnn 7 and cuda 9.0.

However, when trying to import tensorflow, I get the following error:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow  # pylint: 
disable=unused-import
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in 
<module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in 
swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, 
description)
ImportError: /home/boudi/anaconda2/lib/python2.7/site-
packages/tensorflow/python/../libtensorflow_framework.so: undefined 
symbol: cuDevicePrimaryCtxGetState

How can I fix it?

Upvotes: 3

Views: 957

Answers (1)

tsveti_iko
tsveti_iko

Reputation: 8032

I had the same problem - I had already installed the required NVIDIA drivers on my Ubuntu machine, but when I tried to import Tensorflow I got the same error.

So for me the problem was that I was using the Nouveau driver instead of the NVIDIA driver. In order to fix the issue you need to go to System Settings->Software & Updates->Additional Drivers and select the option Using NVIDIA binary driver ... and then click at the Apply Changes button. Then just reboot and you're done.

Upvotes: 1

Related Questions