23

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
  • 31,685
  • 30
  • 101
  • 155
  • 5
    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
  • @KnudLarsen how do you do that? What is the command to run? – Charlie Parker Sep 17 '21 at 20:29
  • 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

3 Answers3

25

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
  • 31,685
  • 30
  • 101
  • 155
  • @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
15

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
  • 165
  • 1
  • 6
  • 5
    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
3

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

module load gcc/9.2.0
Charlie Parker
  • 13,538
  • 41
  • 149
  • 255
  • Put this at the top of my sbatch script and it worked (but with a different version of gcc I had access to), thanks. – jhschwartz Mar 24 '22 at 19:31