Caffe: libstdc++.so.6: version `GLIBCXX_3.4.21' not found

Created on 5 Nov 2016  路  13Comments  路  Source: BVLC/caffe

Hi,
I am learning how to use caffe
I try to run the ipython notebook in the caffe/examples, but it comes to this error:
ImportError: /home/../anaconda2/lib/python2.7/site-packages/zmq/backend/cython/../../../../.././libstdc++.so.6: versionGLIBCXX_3.4.21' not found (required by ../python/caffe/_caffe.so)`

I am using virtual machine ubuntu 16.04 and the caffe is cpu only version.

Can some one help with me?^_^

Steps to reproduce

If you are having difficulty building Caffe or training a model, please ask the caffe-users mailing list. If you are reporting a build error that seems to be due to a bug in Caffe, please attach your build configuration (either Makefile.config or CMakeCache.txt) and the output of the make (or cmake) command.

Your system configuration

Operating system:
Compiler:
CUDA version (if applicable):
CUDNN version (if applicable):
BLAS:
Python or MATLAB version (for pycaffe and matcaffe respectively):

Most helpful comment

conda install libgcc

^ Should fix this error. Please ask installation questions only in the Caffe mailing list.

All 13 comments

conda install libgcc

^ Should fix this error. Please ask installation questions only in the Caffe mailing list.

The solution provided by farazfazli worked, thank you very much :)

@farazfazli After searching on forums this worked f me too :+1: Thanks a lot :)

@farazfazli Thank you really help!

how about this:

import xgboost as xgb

File "/home/tteikhua/anaconda2/lib/python2.7/site-packages/xgboost/__init__.py", line 11, in
from .core import DMatrix, Booster
File "/home/tteikhua/anaconda2/lib/python2.7/site-packages/xgboost/core.py", line 112, in
_LIB = _load_lib()
File "/home/tteikhua/anaconda2/lib/python2.7/site-packages/xgboost/core.py", line 106, in _load_lib
lib = ctypes.cdll.LoadLibrary(lib_path[0])
File "/home/tteikhua/anaconda2/lib/python2.7/ctypes/__init__.py", line 440, in LoadLibrary
return self._dlltype(name)
File "/home/tteikhua/anaconda2/lib/python2.7/ctypes/__init__.py", line 362, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /home/tteikhua/anaconda2/lib/python2.7/site-packages/scipy/sparse/../../../../libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/tteikhua/anaconda2/lib/python2.7/site-packages/xgboost/./lib/libxgboost.so)

I have the same problem:
ImportError: /home/katydagoth/anaconda2/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/katydagoth/Downloads/caffe2/caffe-master/python/caffe/_caffe.so),
but it appears only when anaconda is activated. When deactivated it works well. libgcc is already installed. How can I fix this?

I have same problems when
import rtree
If anyone could help, I really appreciate it!

@farazfazli this didn't solve the issue for me:

$ sudo conda install libgcc
[sudo] password for jalal: 
Solving environment: done

## Package Plan ##

  environment location: /scratch/sjn-p2/anaconda/anaconda2

  added / updated specs: 
    - libgcc


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    libgcc-7.2.0               |       h69d50b8_2         304 KB

The following packages will be UPDATED:

    libgcc: 7.2.0-h69d50b8_2 anaconda --> 7.2.0-h69d50b8_2

Proceed ([y]/n)? y


Downloading and Extracting Packages
libgcc 7.2.0: ################################################################################################################################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
[jalal@goku pytorch_sentiment_rnn]$ python prepare.py 
/scratch/sjn-p2/anaconda/anaconda2/lib/python2.7/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Using TensorFlow backend.
Traceback (most recent call last):
  File "prepare.py", line 6, in <module>
    from keras.preprocessing import sequence
  File "/scratch/sjn-p2/anaconda/anaconda2/lib/python2.7/site-packages/keras/__init__.py", line 3, in <module>
    from . import utils
  File "/scratch/sjn-p2/anaconda/anaconda2/lib/python2.7/site-packages/keras/utils/__init__.py", line 6, in <module>
    from . import conv_utils
  File "/scratch/sjn-p2/anaconda/anaconda2/lib/python2.7/site-packages/keras/utils/conv_utils.py", line 9, in <module>
    from .. import backend as K
  File "/scratch/sjn-p2/anaconda/anaconda2/lib/python2.7/site-packages/keras/backend/__init__.py", line 84, in <module>
    from .tensorflow_backend import *
  File "/scratch/sjn-p2/anaconda/anaconda2/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 5, in <module>
    import tensorflow as tf
  File "/scratch/sjn-p2/anaconda/anaconda2/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/scratch/sjn-p2/anaconda/anaconda2/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 52, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "/scratch/sjn-p2/anaconda/anaconda2/lib/python2.7/site-packages/tensorflow/core/framework/graph_pb2.py", line 6, in <module>
    from google.protobuf import descriptor as _descriptor
  File "/scratch/sjn-p2/anaconda/anaconda2/lib/python2.7/site-packages/google/protobuf/descriptor.py", line 46, in <module>
    from google.protobuf.pyext import _message
ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /scratch/sjn-p2/anaconda/anaconda2/lib/python2.7/site-packages/google/protobuf/pyext/_message.so)

I fixed s similar problem reinstalling the affected program by PIP. (pip install -I ...). Conda broken dependencies are tiring me.

try:

conda install libgcc

Try running your code again. If it still does not work try finding the location of libstdc++.so.6. It is usually in /home/user/anaconda3/lib/ and set the LD_LIBRARY_PATH environment variable.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/miniconda3/lib/

conda install libgcc worked for me.

try:

conda install libgcc

Try running your code again. If it still does not work try finding the location of libstdc++.so.6. It is usually in /home/user/anaconda3/lib/ and set the LD_LIBRARY_PATH environment variable.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/miniconda3/lib/

I did conda install libgcc and

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/miniconda3/lib/

and it worked.

Also make sure your not doing multiprocessing code. For me that gave me pickle errors.

Was this page helpful?
0 / 5 - 0 ratings