ImportError:/lib64/libstdc++.so.6:未找到版本“CXXABI_1.3.8”

ImportError:/lib64/libstdc++.so.6:未找到版本“CXXABI_1.3.8”

我正在尝试在大学集群上运行深度学习模型。当我编写运行模型的命令时,我收到此错误。

15CS10019@cpusrv-gpu-112:~/Tushar/Rod-keras_yolo2-master$ python3 train.py -c config.json
Using TensorFlow backend.
Traceback (most recent call last):
  File "/home/bt3/15CS10019/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/bt3/15CS10019/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/bt3/15CS10019/.local/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 "/usr/local/lib/python3.7/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/local/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/bt3/15CS10019/.local/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 "train.py", line 3, in <module>
    from keras_yolov2.preprocessing import parse_annotation_xml, parse_annotation_csv
  File "/home/bt3/15CS10019/Tushar/Rod-keras_yolo2-master/keras_yolov2/preprocessing.py", line 1, in <module>
    from .utils import BoundBox, bbox_iou
  File "/home/bt3/15CS10019/Tushar/Rod-keras_yolo2-master/keras_yolov2/utils.py", line 1, in <module>
    from .backend import (TinyYoloFeature, FullYoloFeature, MobileNetFeature, SqueezeNetFeature, Inception3Feature,
  File "/home/bt3/15CS10019/Tushar/Rod-keras_yolo2-master/keras_yolov2/backend.py", line 1, in <module>
    from keras.models import Model
  File "/usr/local/lib/python3.7/site-packages/keras/__init__.py", line 3, in <module>
    from . import utils
  File "/usr/local/lib/python3.7/site-packages/keras/utils/__init__.py", line 6, in <module>
    from . import conv_utils
  File "/usr/local/lib/python3.7/site-packages/keras/utils/conv_utils.py", line 9, in <module>
    from .. import backend as K
  File "/usr/local/lib/python3.7/site-packages/keras/backend/__init__.py", line 89, in <module>
    from .tensorflow_backend import *
  File "/usr/local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 5, in <module>
    import tensorflow as tf
  File "/home/bt3/15CS10019/.local/lib/python3.7/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/home/bt3/15CS10019/.local/lib/python3.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/bt3/15CS10019/.local/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/bt3/15CS10019/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/home/bt3/15CS10019/.local/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "/home/bt3/15CS10019/.local/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 "/usr/local/lib/python3.7/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/usr/local/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/bt3/15CS10019/.local/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.

我该如何解决这个错误?

答案1

您需要安装支持 的 gcc 版本CXXABI_1.3.8

首先查看您当前的版本,运行:

gcc -v

在你的机器中找到 c++ 标准库,运行:

sudo find / -name 'libstdc++.so.6'

查看你的图书馆,运行:

strings /lib64/libstdc++.so.6 | grep '^CXXABI_'

按照下面的说明编译新版本的 gcc:

# Install dependencies
sudo yum check-update
sudo yum -y install wget make gcc-c++

# Download gcc new version
wget -O - 'https://ftpmirror.gnu.org/gcc/gcc-7.3.0/gcc-7.3.0.tar.xz' | tar -xJ

# This helps if you are behind a proxy
sed -i 's/ftp:/https:/' ./gcc-7.3.0/contrib/download_prerequisites

# Finally compile gcc 
( cd gcc-7.3.0 && ./contrib/download_prerequisites && mkdir build && cd build && ../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib && make -j 8 && sudo make install ) && rm -fR gcc-7.3.0

# Unlink current version
sudo unlink /usr/lib64/libstdc++.so.6

# Copy new version
sudo cp /usr/local/lib64/libstdc++.so.6 /usr/lib64

答案2

因此,在尝试了许多解决方案之后,解决错误的方法就是简单地从libstdc++.so.6我的系统上复制另一个版本。

# Search for all libstdc++.so.6 on my system
sudo find / -name 'libstdc++.so.6'

# Get all the ABIs supported by the faulting dynamic library
# Here, change "/opt/Xilinx/14.7/ISE_DS/ISE/lib/lin64/libstdc++.so.6"
strings /opt/Xilinx/14.7/ISE_DS/ISE/lib/lin64/libstdc++.so.6 | grep '^CXXABI_'

# The same for the dynamic library I with to copy
# Here, change "/usr/lib/x86_64-linux-gnu/libstdc++.so.6"
# Check that the ABI version that was being looked for is supported here!
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep '^CXXABI_'

# Move the faulting dynamic library aside
sudo mv /opt/Xilinx/14.7/ISE_DS/ISE/lib/lin64/libstdc++.so.6 \
/opt/Xilinx/14.7/ISE_DS/ISE/lib/lin64/libstdc++.so.6.bk

# Copy the dynamic library
cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 \
/opt/Xilinx/14.7/ISE_DS/ISE/lib/lin64/libstdc++.so.6

我并不是说这是最好的方法,但它似乎解决了我的问题。

相关内容