tensorflow: Centos7.6+python37+tensorflow1.13.1 : ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found

Python 3.7.1 (default, Dec 14 2018, 19:28:38) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow


Traceback (most recent call last):
  File "/home/zhaodachuan/zhaodachuan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/zhaodachuan/zhaodachuan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/zhaodachuan/zhaodachuan/anaconda3/lib/python3.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)
  File "/home/zhaodachuan/zhaodachuan/anaconda3/lib/python3.7/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/home/zhaodachuan/zhaodachuan/anaconda3/lib/python3.7/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /home/zhaodachuan/zhaodachuan/anaconda3/lib/python3.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/zhaodachuan/zhaodachuan/anaconda3/lib/python3.7/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/home/zhaodachuan/zhaodachuan/anaconda3/lib/python3.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/zhaodachuan/zhaodachuan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/zhaodachuan/zhaodachuan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/zhaodachuan/zhaodachuan/anaconda3/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/zhaodachuan/zhaodachuan/anaconda3/lib/python3.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)
  File "/home/zhaodachuan/zhaodachuan/anaconda3/lib/python3.7/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/home/zhaodachuan/zhaodachuan/anaconda3/lib/python3.7/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /home/zhaodachuan/zhaodachuan/anaconda3/lib/python3.7/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so)


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): CentOS Linux release 7.6.1810 (Core)
  • TensorFlow installed from (source or binary): pip install tensorflow
  • TensorFlow version: 1.13.1
  • Python version: Python 3.7.1
  • Installed using virtualenv? pip? conda?: pip install tensorflow

Describe the problem I think the problem is that the version of gcc is 4.8 on Centos7.6. What should I do to install tensorflow1.13 with Centos7+python37 ?

Provide the exact sequence of commands / steps that you executed before running into the problem

$ pip install tensorflow
$ python 
>>> import tensorflow

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 14
  • Comments: 19 (7 by maintainers)

Most upvoted comments

We have several versions of python available to use. I had this problem when I tried to use python/3.7.3, because it was compiled with gcc/6.4 (on a different system), but our system only has gcc/6.3.1 support. I found that we have an older version of python (3.6.2) that was compiled with gcc/4.8.5, so I switched to that, and then import tensorflow worked just fine.

So the workaround is to install a version of python that is compatible (or older) with gcc on your system.

When you run python, it immediately prints out the version of gcc support to the console, and you can check the version of gcc install with gcc --version.

I bet that if you recompile python3 on your system, then tensorflow will run.

This combination worked for me:

$ python3
Python 3.6.2 (default, Jul 27 2017, 20:29:23)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux

$ gcc --version
gcc (GCC) 6.3.1 20170216 (Red Hat 6.3.1-3)

(python older than gcc)

Build gcc 6.3, you would get libstdc++.so.6.0.22. Create libstdc++.so.6 soft-link to it, may solve your problem

Build GCC6.3, you will get the libstdc++.so.6.0.22

Just wanted to add that I have this issue, as well. Very similar configuration as OP.

It gave me same error when I tried to install with pip. I am using conda. I tried with conda (conda install tensorflow). It worked.

strings /usr/lib64/libstdc++.so.6.0.19 | grep CXXABI_ to check whether `CXXABI_1.3.8’. If not, you could use latest lib version. Set the LD_LIBRARY_PATH before you run TF, so this lib would only be effective in this shell.