ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found

Hello,
Can somebody help me with this error?

Traceback (most recent call last):
  File "/home/alijani/.conda/envs/py3/lib/python3.9/runpy.py", line 188, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/home/alijani/.conda/envs/py3/lib/python3.9/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "/home/alijani/WS_Farid/OxfordRobotCar/rir2-bu/cirtorch/__init__.py", line 3, in <module>
    from .datasets import datahelpers, genericdataset, testdataset, traindataset
  File "/home/alijani/WS_Farid/OxfordRobotCar/rir2-bu/cirtorch/datasets/traindataset.py", line 7, in <module>
    from cirtorch.datasets.image_augmentation import AlbumentationsImageAugmentor
  File "/home/alijani/WS_Farid/OxfordRobotCar/rir2-bu/cirtorch/datasets/image_augmentation.py", line 3, in <module>
    from albumentations import Compose, HorizontalFlip, PadIfNeeded, RandomCrop
  File "/home/alijani/.conda/envs/py3/lib/python3.9/site-packages/albumentations/__init__.py", line 5, in <module>
    from .core.composition import *
  File "/home/alijani/.conda/envs/py3/lib/python3.9/site-packages/albumentations/core/composition.py", line 8, in <module>
    from albumentations.augmentations.keypoints_utils import KeypointsProcessor
  File "/home/alijani/.conda/envs/py3/lib/python3.9/site-packages/albumentations/augmentations/__init__.py", line 4, in <module>
    from .functional import *
  File "/home/alijani/.conda/envs/py3/lib/python3.9/site-packages/albumentations/augmentations/functional.py", line 9, in <module>
    from scipy.ndimage.filters import gaussian_filter
  File "/home/alijani/.conda/envs/py3/lib/python3.9/site-packages/scipy/__init__.py", line 155, in <module>
    from . import fft
  File "/home/alijani/.conda/envs/py3/lib/python3.9/site-packages/scipy/fft/__init__.py", line 74, in <module>
    from ._basic import (
  File "/home/alijani/.conda/envs/py3/lib/python3.9/site-packages/scipy/fft/_basic.py", line 1, in <module>
    from scipy._lib.uarray import generate_multimethod, Dispatchable
  File "/home/alijani/.conda/envs/py3/lib/python3.9/site-packages/scipy/_lib/uarray.py", line 28, in <module>
    from ._uarray import *
  File "/home/alijani/.conda/envs/py3/lib/python3.9/site-packages/scipy/_lib/_uarray/__init__.py", line 115, in <module>
    from ._backend import *
  File "/home/alijani/.conda/envs/py3/lib/python3.9/site-packages/scipy/_lib/_uarray/_backend.py", line 4, in <module>
    from . import _uarray  # type: ignore
ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/alijani/.conda/envs/py3/lib/python3.9/site-packages/scipy/_lib/_uarray/_uarray.cpython-39-x86_64-linux-gnu.so)

Environment:

$ nvidia-smi 
Tue Feb 16 11:31:34 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.32.03    Driver Version: 460.32.03    CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Tesla K40m          On   | 00000000:03:00.0 Off |                    0 |
| N/A   32C    P8    20W / 235W |      0MiB / 11441MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

$ python -c "import torch; print(torch.__config__.show())"
PyTorch built with:
  - GCC 7.3
  - C++ Version: 201402
  - Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v1.6.0 (Git Hash 5ef631a030a6f73131c77892041042805a06064f)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 11.0
  - NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80
  - CuDNN 8.0.5
  - Magma 2.5.2
  - Build settings: BLAS=MKL, BUILD_TYPE=Release, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DUSE_VULKAN_WRAPPER -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, USE_CUDA=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON,

torch: 1.7.1+cu110
torchvision: 0.8.2+cu110
Python 3.9.1 (default, Dec 11 2020, 14:32:07) 
[GCC 7.3.0] :: Anaconda, Inc. on linux

and my conda packages:

$ conda list --show-channel-urls
# packages in environment at /home/alijani/.conda/envs/py3:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
albumentations            0.5.2              pyhd8ed1ab_0    conda-forge
blas                      1.0                    openblas    defaults
bzip2                     1.0.8                h7b6447c_0    defaults
ca-certificates           2020.12.5            ha878542_0    conda-forge
cairo                     1.16.0            h7979940_1007    conda-forge
certifi                   2020.12.5        py39hf3d152e_1    conda-forge
cloudpickle               1.6.0                      py_0    defaults
cycler                    0.10.0           py39h06a4308_0    defaults
cytoolz                   0.11.0           py39h27cfd23_0    defaults
dask-core                 2021.1.1           pyhd3eb1b0_0    defaults
dbus                      1.13.18              hb2f20db_0    defaults
decorator                 4.4.2              pyhd3eb1b0_0    defaults
expat                     2.2.10               he6710b0_2    defaults
ffmpeg                    4.3.1                hca11adc_2    conda-forge
fontconfig                2.13.1            hba837de_1004    conda-forge
freetype                  2.10.4               h5ab3b9f_0    defaults
geos                      3.8.1                he6710b0_0    defaults
gettext                   0.19.8.1             h9b4dc7a_1    defaults
glib                      2.66.4               hc4f0c31_2    conda-forge
glib-tools                2.66.4               hc4f0c31_2    conda-forge
gmp                       6.2.1                h58526e2_0    conda-forge
gnutls                    3.6.13               h85f3911_1    conda-forge
graphite2                 1.3.14               h23475e2_0    defaults
gst-plugins-base          1.14.5               h0935bb2_2    conda-forge
gstreamer                 1.18.3               h3560a44_0    conda-forge
harfbuzz                  2.7.4                h5cf4720_0    conda-forge
hdf5                      1.10.6               hb1b8bf9_0    defaults
icu                       68.1                 h2531618_0    defaults
imageio                   2.9.0                      py_0    defaults
imgaug                    0.4.0              pyhd3eb1b0_0    defaults
jasper                    1.900.1              hd497a04_4    defaults
joblib                    1.0.0              pyhd3eb1b0_0    defaults
jpeg                      9d                   h36c2ea0_0    conda-forge
kiwisolver                1.3.0            py39h66f3464_0    defaults
krb5                      1.17.1               h173b8e3_0    defaults
lame                      3.100                h7b6447c_0    defaults
lcms2                     2.11                 h396b838_0    defaults
ld_impl_linux-64          2.33.1               h53a641e_7    defaults
libblas                   3.8.0               17_openblas    conda-forge
libcblas                  3.8.0               17_openblas    conda-forge
libclang                  11.0.1          default_ha53f305_1    conda-forge
libedit                   3.1.20191231         h14c3975_1    defaults
libevent                  2.1.10               hcdb4288_3    conda-forge
libffi                    3.3                  he6710b0_2    defaults
libgcc                    7.2.0                h69d50b8_2    conda-forge
libgcc-ng                 9.3.0               h2828fa1_18    conda-forge
libgfortran-ng            7.3.0                hdf63c60_0    defaults
libglib                   2.66.4               h748fe8e_2    conda-forge
libgomp                   9.3.0               h2828fa1_18    conda-forge
libiconv                  1.16                 h516909a_0    conda-forge
liblapack                 3.8.0               17_openblas    conda-forge
liblapacke                3.8.0               17_openblas    conda-forge
libllvm11                 11.0.1               hf817b99_0    conda-forge
libopenblas               0.3.10               h5a2b251_0    defaults
libopencv                 4.5.0                    py39_2    conda-forge
libpng                    1.6.37               hbc83047_0    defaults
libpq                     12.3                 h255efa7_3    conda-forge
libstdcxx-ng              9.3.0               h6de172a_18    conda-forge
libtiff                   4.1.0                h2733197_1    defaults
libuuid                   2.32.1            h7f98852_1000    conda-forge
libwebp-base              1.2.0                h27cfd23_0    defaults
libxcb                    1.14                 h7b6447c_0    defaults
libxkbcommon              1.0.3                he3ba5ed_0    conda-forge
libxml2                   2.9.10               h72842e0_3    conda-forge
lz4-c                     1.9.2                heb0550a_3    defaults
matplotlib                3.3.2                h06a4308_0    defaults
matplotlib-base           3.3.2            py39hd261b2b_0    defaults
mysql-common              8.0.22               ha770c72_3    conda-forge
mysql-libs                8.0.22               h935591d_3    conda-forge
ncurses                   6.2                  he6710b0_1    defaults
nettle                    3.6                  he412f7d_0    conda-forge
networkx                  2.5                        py_0    defaults
nspr                      4.29                 h9c3ff4c_1    conda-forge
nss                       3.61                 hb5efdd6_0    conda-forge
numpy                     1.20.0                   pypi_0    pypi
numpy-base                1.19.2           py39h0f7b65f_0    defaults
olefile                   0.46                       py_0    defaults
opencv                    4.5.0                    py39_2    conda-forge
opencv-contrib-python     4.5.1.48                 pypi_0    pypi
openh264                  2.1.1                h780b84a_0    conda-forge
openssl                   1.1.1i               h7f98852_0    conda-forge
pcre                      8.44                 he6710b0_0    defaults
pillow                    8.1.0            py39he98fc37_0    defaults
pip                       20.3.3           py39h06a4308_0    defaults
pixman                    0.40.0               h7b6447c_0    defaults
py-opencv                 4.5.0            py39h9cd51e4_2    conda-forge
pyparsing                 2.4.7              pyhd3eb1b0_0    defaults
pyqt                      5.12.3           py39hf3d152e_7    conda-forge
pyqt-impl                 5.12.3           py39h0fcd23e_7    conda-forge
pyqt5-sip                 4.19.18          py39he80948d_7    conda-forge
pyqtchart                 5.12             py39h0fcd23e_7    conda-forge
pyqtwebengine             5.12.1           py39h0fcd23e_7    conda-forge
python                    3.9.1                hdb3f193_2    defaults
python-dateutil           2.8.1              pyhd3eb1b0_0    defaults
python_abi                3.9                      1_cp39    conda-forge
pywavelets                1.1.1            py39h6323ea4_4    defaults
pyyaml                    5.4.1            py39h27cfd23_1    defaults
qt                        5.12.9               h9d6b050_2    conda-forge
readline                  8.1                  h27cfd23_0    defaults
scikit-image              0.16.2           py39ha9443f7_0    defaults
scikit-learn              0.23.2           py39ha9443f7_0    defaults
scipy                     1.5.2            py39hf56f3a7_0    defaults
see                       1.4.1                    pypi_0    pypi
setuptools                52.0.0           py39h06a4308_0    defaults
shapely                   1.7.1            py39hfa2dc8b_1    conda-forge
six                       1.15.0           py39h06a4308_0    defaults
sqlite                    3.34.0               h74cdb3f_0    conda-forge
threadpoolctl             2.1.0              pyh5ca1d4c_0    defaults
tk                        8.6.10               hbc83047_0    defaults
toolz                     0.11.1             pyhd3eb1b0_0    defaults
torch                     1.7.1+cu110              pypi_0    pypi
torchaudio                0.7.2                    pypi_0    pypi
torchvision               0.8.2+cu110              pypi_0    pypi
tornado                   6.1              py39h27cfd23_0    defaults
typing-extensions         3.7.4.3                  pypi_0    pypi
tzdata                    2020f                h52ac0ba_0    defaults
wheel                     0.36.2             pyhd3eb1b0_0    defaults
x264                      1!161.3030           h7f98852_0    conda-forge
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libice               1.0.10               h516909a_0    conda-forge
xorg-libsm                1.2.3             h84519dc_1000    conda-forge
xorg-libx11               1.6.12               h516909a_0    conda-forge
xorg-libxext              1.3.4                h516909a_0    conda-forge
xorg-libxrender           0.9.10            h516909a_1002    conda-forge
xorg-renderproto          0.11.1            h14c3975_1002    conda-forge
xorg-xextproto            7.3.0             h7f98852_1002    conda-forge
xorg-xproto               7.0.31            h27cfd23_1007    defaults
xz                        5.2.5                h7b6447c_0    defaults
yaml                      0.2.5                h7b6447c_0    defaults
zlib                      1.2.11               h7b6447c_3    defaults
zstd                      1.4.8                hdf46e1d_0    conda-forge
1 Like

It seems this error is raised by scipy and you could try to use conda install libgcc to fix it.

but I have already installed libgcc. It is visible in my conda packages!

This url may help you.
https://itbilu.com/linux/management/NymXRUieg.html

1 Like

Thank you, this helped me. <3

Hi how did you solve it? I have the same problem. Installing libgcc or change export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: won’t work for me.

Same… Installing libgcc or change export did not work.
Just renamed the miniconda3 lib in the Home folder, so that it takes the libstdc++ file from the default system location. This solved the issue

I got same issue when installed xformers - which updated torch 1.11 to 1.13 and the issue started