Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
xonez opened this issue Nov 5, 2016 · 19 comments
Closed

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

xonez opened this issue Nov 5, 2016 · 19 comments

Comments

@xonez
Copy link

xonez commented Nov 5, 2016

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: version GLIBCXX_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):

@farazfazli
Copy link

farazfazli commented Nov 7, 2016

conda install libgcc

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

@dangmanhtruong1995
Copy link

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

@hopeai
Copy link

hopeai commented Mar 12, 2017

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

@JasonDoingGreat
Copy link

@farazfazli Thank you really help!

@tthtlc
Copy link

tthtlc commented May 6, 2017

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)

@moon-and-star
Copy link

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?

@yuanviola
Copy link

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

@monajalal
Copy link

monajalal commented Mar 9, 2018

@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)

@hopeai
Copy link

hopeai commented Mar 9, 2018

ijlyttle added a commit to ijlyttle/altair that referenced this issue Jul 14, 2018
ijlyttle added a commit to vegawidget/altair that referenced this issue Jul 14, 2018
* updates reticulate-version required, removes r_to_py() references

* removes r_to_py() from examples

* switches over to vegawidget

* impoprts the knit.print method for vegaspec from vegawidget

* try again with travis

* retry travis

* again with travis

* try installing twice

* another trvais attempt

* digging deeper on travis

* removing cache on travis

* travis: re-cache packages, adds apt-get upgrade

* adds `conda install libgcc` according to BVLC/caffe#4953 (comment)

* adjusts travis

* investigating versions of libstdc++6 according to https://stackoverflow.com/questions/44773296/libstdc-so-6-version-glibcxx-3-4-20-not-found

* upgrades libstdc++6 on travis

* installs only libstdc++6

* adds additional apt repository to see if we can get a later version of GLIBCXX

* tweaks travis

* purge, suggested by https://askubuntu.com/questions/777803/apt-relocation-error-version-glibcxx-3-4-21-not-defined-in-file-libstdc-so-6

* adds ppa-purge to travis

* trying to get python to downgrade to 3.6.6

* tweaks travis again

* try again to downgrade python at travis

* tries to force upgrade of pandas

* downgrades pandas for travis

* try another pandas downgrade

* try again
@Lucioric2000
Copy link

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

@senjed
Copy link

senjed commented Jul 20, 2020

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/

@chenrq2005
Copy link

conda install libgcc worked for me.

@brando90
Copy link

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.

@bvannah
Copy link

bvannah commented Sep 3, 2021

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.

Thank you, this worked for me

@karkir0003
Copy link

Will this fix work for github actions?

@szj-github
Copy link

add export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/user/anaconda3/lib/ , it worked for me! thanks!

@safelysparky
Copy link

I was able to fix the issue by running
conda update libstdcxx-ng

@ShunLu91
Copy link

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/

Great thanks and this solution really helps me.

@luq7
Copy link

luq7 commented Jun 22, 2023

I was able to fix the issue by running
conda update libstdcxx-ng

This worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests