This is because you have some old versions not cleaned up while upgrading gcc.

First of all, make sure that you have the latest lib with conda install -c conda-forge libstdcxx-ng

  1. Find all your lib versions with find / -name "libstdc++.so*". My latest version is 6.0.30.
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.29
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.so
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.so.6.0.29
/usr/lib/gcc/x86_64-linux-gnu/9/libstdc++.so.6.0
/opt/conda/lib/libstdc++.so.6.0.29
/opt/conda/lib/libstdc++.so.6
/opt/conda/envs/xxx/lib/libstdc++.so.6.0.30
/opt/conda/envs/xxx/lib/libstdc++.so.6
/opt/conda/pkgs/libgcc-7.2.0-h69d50b8_2/lib/libstdc++.so.6.0.21
/opt/conda/pkgs/libstdcxx-ng-12.1.0-ha89aaad_16/lib/libstdc++.so.6.0.30
/opt/conda/pkgs/libstdcxx-ng-12.1.0-ha89aaad_16/lib/libstdc++.so.6
/opt/conda/pkgs/libstdcxx-ng-12.1.0-ha89aaad_16/lib/libstdc++.so
  1. Copy the file to the folder where you are working at and only have the old versions. /opt/conda/lib/ or /opt/conda/envs/xxx/lib/

For example, I'm working on /opt/conda/lib/

cp /opt/conda/pkgs/libstdcxx-ng-12.1.0-ha89aaad_16/lib/libstdc++.so.6.0.30 /opt/conda/lib/
  1. Remove the old files and link the latest lib. Please repeat these steps for other folders.
cd /opt/conda/lib/
rm libstdc++.so.6.0.29
rm libstdc++.so.6.0
ln -s libstdc++.so.6.0.30 libstdc++.so.6
Answer from Wenning Lin on Stack Overflow
🌐
Anaconda.org
anaconda.org › anaconda › libgcc
libgcc - anaconda | Anaconda.org
Install libgcc with Anaconda.org. The GCC low-level runtime library
🌐
Anaconda.org
anaconda.org › conda-forge › libgcc-ng
libgcc-ng - conda-forge | Anaconda.org
conda-forge/libgcc-ng · Community · The GCC low-level runtime library · Copied fromcf-post-staging / libgcc-ng · Overview · Files 722 · Labels 5 · Badges · Versions · 15.2.0 · To install this package, run one of the following: $conda install conda-forge::libgcc-ng ·
🌐
Narkive
conda.continuum.narkive.com › HAOVyLLY › libgcc-5-2-0-is-not-available-for-osx
[conda] libgcc 5.2.0 is not available for OSX
Permalink libgcc 5.2.0 package in python is not available for OSX. https://anaconda.org/anaconda/libgcc $ conda install libgcc=5.2.0 Fetching package metadata ...........
🌐
GitHub
github.com › OceanParcels › parcels › issues › 591
gcc compiler on linux · Issue #591 · Parcels-code/Parcels
May 14, 2019 - It seems many conda installations are currently struggling with gcc on linux. So far in parcels, we were using the system gcc (I think it wasn't the case i the past), but if we want to have more control over the compilation options (openmp, mpi, ...) we need to control gcc version as well. This is currently done in PR #583, but it breaks on linux. The issue message was ... This error can be fixed adding libgcc=5.2.0 (see for example here ).
Author   Parcels-code
🌐
GitHub
github.com › conda-forge › spacy-feedstock › issues › 16
libgcc missing run requirement on linux? · Issue #16 · conda-forge/spacy-feedstock
August 5, 2017 - Solving package specifications: . Package plan for installation in environment /opt/conda: The following NEW packages will be INSTALLED: libgcc: 5.2.0-0 Proceed ([y]/n)?
Author   conda-forge
🌐
Anaconda.org
anaconda.org › conda-forge › libgcc
libgcc - conda-forge | Anaconda.org
Install libgcc with Anaconda.org. The GCC low-level runtime library
🌐
Conda
docs.conda.io › projects › conda-build › en › stable › resources › compiler-tools.html
Anaconda compiler tools — conda-build 0.0.0.dev0+placeholder documentation
This is done by changing the link_libgcc: section inside GCC specs file, and this change is done so that LD_LIBRARY_PATH isn't required for basic libraries. conda-build knows how to make this automatically relocatable, so that this RPATH will be changed to point to the environment where the package is being installed (at installation time, by conda).
🌐
GitHub
github.com › dmlc › xgboost › issues › 1043
error in ubuntu libstdc++.so.6: version `GLIBCXX_3.4.20' not found · Issue #1043 · dmlc/xgboost
March 24, 2016 - Trying to install xgboost I have the following error. OSError: /home/al/anaconda3/lib/python3.5/site-packages/scipy/sparse/../../../../libstdc++.so.6: versionGLIBCXX_3.4.20' not found (required by /home/al/anaconda3/lib/python3.5/site-packages/xgboost-0.4-py3.5.egg/xgboost/libxgboost.so)` I'm running Python 3.5.1 |Anaconda 2.4.0 (64-bit)| (default, Dec 7 2015, 11:16:01) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Author   dmlc
Find elsewhere
🌐
GitHub
github.com › vtraag › leidenalg › issues › 2
conda installation fails: ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found · Issue #2 · vtraag/leidenalg
November 8, 2018 - After installing leidenalg with conda I got the following error: ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found I could solve it by downgrading to libgcc==5.2.0 (my orig...
Author   vtraag
🌐
Psicode
forum.psicode.org › build
Conda Install for 1.5 - build - Psi4 – Open-Source Quantum Chemistry
June 3, 2022 - Is this the correct command → conda install psi4=1.5 libint2=*=hc9558a2_9 python=3.8 -c psi4 Not able to get this to work. thanks.
🌐
PyTorch Forums
discuss.pytorch.org › t › conda-install-issue › 12548
Conda install issue - PyTorch Forums
January 19, 2018 - The command I use is: conda install -c pytorch pytorch The following NEW packages will be INSTALLED: ca-certificates: 2017.11.5-0 conda-forge certifi: 2017.11.5-py36_0 conda-forge cffi: 1.11.2-py36_0 conda-forge cudatoolkit: 8.0-3 cudnn: ...
🌐
Google Groups
groups.google.com › a › continuum.io › g › anaconda › c › VX8Py_-_Uj4
Hundreds of errors with glibc version
December 1, 2022 - You don't have permission to access this content · For access, try contacting the group's owners and managers If you are subscribed to this group and have noticed abuse, report abusive group
🌐
Prefix.dev
prefix.dev › channels › conda-forge › packages › libgcc
libgcc - conda-forge
A community led collection of recipes, build infrastructure and distributions for the conda package manager.
🌐
GitHub
github.com › conda-forge › conda-forge.github.io › issues › 763
Cannot install python=3.7 on Linux (libgcc-ng missing?) · Issue #763 · conda-forge/conda-forge.github.io
July 26, 2021 - Manually digging into this, it looks like libgcc-ng and libstdcxx-ng are both missing from the repodata.json file. When I run conda create -n test sqlite, this installs sqlite 3.22.0, which seems to be the lates tversion of sqlite on conda-forge without an explicit dependency on libgcc-ng, so it looks like a missing libgcc-ng might be the problem?
Author   conda-forge
Top answer
1 of 2
2

Just to share, not sure it will help you. However it shows that in standard conditions it is possible to use the conda gcc as described in the documentation instead of the system gcc.

# system gcc
which gcc && gcc --version
# /usr/bin/gcc
# gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

# creating a conda env with gcc
conda create -n gcc gcc
# activate the environment
conda activating gcc
which gcc && gcc --version
# /opt/conda/envs/gcc/bin/gcc
# gcc (GCC) 11.2.0

Here is the list of packages installed on a fresh environment created with only gcc.

# packages in environment at /opt/conda/envs/gcc:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
binutils_impl_linux-64    2.36.1               h193b22a_2    conda-forge
gcc                       11.2.0               h702ea55_2    conda-forge
gcc_impl_linux-64         11.2.0              h82a94d6_11    conda-forge
kernel-headers_linux-64   2.6.32              he073ed8_15    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
libgcc-devel_linux-64     11.2.0              h0952999_11    conda-forge
libgcc-ng                 11.2.0              h1d223b6_11    conda-forge
libgomp                   11.2.0              h1d223b6_11    conda-forge
libsanitizer              11.2.0              he4da1e4_11    conda-forge
libstdcxx-ng              11.2.0              he4da1e4_11    conda-forge
sysroot_linux-64          2.12                he073ed8_15    conda-forge
2 of 2
0

In addition to the solution posted in this issue. I added symbolic-links that point to the conda installed gcc, which I was missing.

ln -s /home/envs/segmentation_base/bin/x86_64-conda_cos6-linux-gnu-cc gcc
ln -s /home/envs/segmentation_base/bin/x86_64-conda_cos6-linux-gnu-cpp g++
🌐
GitHub
github.com › ilastik › ilastik-build-conda › issues › 24
conda's libgcc package masks the system libstdc++.so · Issue #24 · ilastik/ilastik-conda-recipes
October 7, 2016 - Yes, apparently R packages need it: Try conda create -n testenv -c r r-essentials. (It will download libgcc.) That's how the user in thread 2 discovered this problem. ... Sorry about the delay here.
Author   ilastik
🌐
Libraries.io
libraries.io › conda › libgcc-ng
libgcc-ng 15.2.0 on conda - Libraries.io - security & maintenance data for open source software
November 28, 2017 - conda install -c anaconda libgcc-ng · Dependencies · 2 · Dependent packages · 4.99K · Dependent repositories · 2.8K · Total releases · 28 · Latest release · Nov 10, 2025 · First release · Nov 28, 2017 · SourceRank · 18 · 15.2.0 ...
🌐
Anaconda.org
anaconda.org › anaconda › libgcc-ng
libgcc-ng - anaconda | Anaconda.org
Install libgcc-ng with Anaconda.org. The GCC low-level runtime library
🌐
GitHub
github.com › conda-forge › protobuf-feedstock › issues › 64
ABI problems when gcc is installed into conda environment · Issue #64 · conda-forge/protobuf-feedstock
April 3, 2019 - When gcc is installed using conda insall -y gcc in a py3.7 (applies also for py3.6) env a too old libstdc++ is installed, which leads to ABI problems. These ABI problems can easily be seen when proto --version is run. The workaround for this issue is to install libgcc=5.2.0.
Author   conda-forge