35

I am getting the following error:

ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /home/wasiahmad/software/anaconda3/lib/python3.6/site-packages/matplotlib/_path.cpython-36m-x86_64-linux-gnu.so)

at this line:

import matplotlib.pyplot as plt

I have visited issues reported in Github and StackOverflow and followed them but still couldn't solve the problem.

Solutions checked:

I have checked that the file: libstdc++.so.6 is located at /home/wasiahmad/software/anaconda3/lib/ and I ran the following command:

$ strings ~/software/anaconda3/lib/libstdc++.so.6 | grep CXXABI_1.3.9

and it returns CXXABI_1.3.9.

But I still can't figure out what is the problem. Any help would be appreciated.

Wasi Ahmad
  • 35,739
  • 32
  • 114
  • 161
  • 6
    I guess you will have to include `/home/wasiahmad/software/anaconda3/lib/` in the `LD_LIBRARY_PATH` ... Be aware that `/lib64/libstdc++.so.6` currently comes first in "LD_LIBRARY_PATH". – Knud Larsen Apr 17 '18 at 13:48
  • 1
    Charlie Parker: `export LD_LIBRARY_PATH=/home/wasiahmad/software/anaconda3/lib:$LD_LIBRARY_PATH` ....... then the "new libstdc++.so.6" in 'anaconda3/lib' is first in the search path. – Knud Larsen Sep 17 '21 at 20:42

4 Answers4

37

Adding /home/wasiahmad/software/anaconda3/lib/ to the LD_LIBRARY_PATH solved the problem. Thanks to Knud Larsen for his comment and the reminder that /lib64/libstdc++.so.6 currently comes first in LD_LIBRARY_PATH.

Wasi Ahmad
  • 35,739
  • 32
  • 114
  • 161
  • @Knud I receive similar error while spacy is imported. I was wondering if you have suggestions since my program still pick/s lib64/libstdc++.so.6 eventhough I have defined the property in the top level script as os.environ['LD_LIBRARY_PATH'] = '/conda/env/path' – Gladiator Jul 26 '21 at 18:27
  • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your/path/to/conda/env/lib @CharlieParker – pooria Oct 26 '21 at 18:38
26

I totally agree with the accepted answer from @wasi-ahmad.

More specifically, typing

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/wasiahmad/software/anaconda3/lib/

in the terminal will solve the problem

saleh
  • 375
  • 3
  • 8
  • 6
    Use of (previous response) is not appropriate. Because, in future place of answers will be changed based on Stack Overflow ranking system. – Hamed Baziyad Jan 22 '20 at 16:22
10

if you are in a HPC this worked for me I think:

module load gcc/9.2.0
Charlie Parker
  • 5,884
  • 57
  • 198
  • 323
0

For the C++ guys:
Run the following at same place where you are compiling your program

export LD_LIBRARY_PATH=../lib_start/:/usr/local/lib:/usr/local/lib64