简体   繁体   中英

ImportError: /usr/lib/aarch64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found

I install the kneed package in linux aarch64 architecture in miniconda3 . When I import kneed inside python, I got the following error

 import kneed
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/su/miniconda3/envs/myenv/lib/python3.10/site-packages/kneed/__init__.py", line 4, in <module>
    from .knee_locator import KneeLocator
  File "/home/su/miniconda3/envs/myenv/lib/python3.10/site-packages/kneed/knee_locator.py", line 3, in <module>
    from scipy.signal import argrelextrema
  File "/home/su/miniconda3/envs/myenv/lib/python3.10/site-packages/scipy/signal/__init__.py", line 309, in <module>
    from . import _sigtools, windows
  File "/home/su/miniconda3/envs/myenv/lib/python3.10/site-packages/scipy/signal/windows/__init__.py", line 41, in <module>
    from ._windows import *
  File "/home/su/miniconda3/envs/myenv/lib/python3.10/site-packages/scipy/signal/windows/_windows.py", line 7, in <module>
    from scipy import linalg, special, fft as sp_fft
  File "/home/su/miniconda3/envs/myenv/lib/python3.10/site-packages/scipy/__init__.py", line 211, in __getattr__
    return _importlib.import_module(f'scipy.{name}')
  File "/home/su/miniconda3/envs/myenv/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/su/miniconda3/envs/myenv/lib/python3.10/site-packages/scipy/fft/__init__.py", line 92, in <module>
    from ._helper import next_fast_len
  File "/home/su/miniconda3/envs/myenv/lib/python3.10/site-packages/scipy/fft/_helper.py", line 3, in <module>
    from ._pocketfft import helper as _helper
  File "/home/su/miniconda3/envs/myenv/lib/python3.10/site-packages/scipy/fft/_pocketfft/__init__.py", line 3, in <module>
    from .basic import *
  File "/home/su/miniconda3/envs/myenv/lib/python3.10/site-packages/scipy/fft/_pocketfft/basic.py", line 6, in <module>
    from . import pypocketfft as pfft
ImportError: /usr/lib/aarch64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /home/su/miniconda3/envs/myenv/lib/python3.10/site-packages/scipy/fft/_pocketfft/pypocketfft.cpython-310-aarch64-linux-gnu.so)

When I check libstdc++.so.6,

ls /usr/lib/aarch64-linux-gnu | grep libstdc++.so.6
libstdc++.so.6
libstdc++.so.6.0.28

May I know do I know to install any package to solve the ImportError ?

The below are packages that I install

Package                      Version
---------------------------- ------------
absl-py                      1.2.0
appdirs                      1.4.4
astunparse                   1.6.3
attrs                        22.1.0
audioread                    2.1.9
cachetools                   5.2.0
certifi                      2022.6.15
cffi                         1.15.1
charset-normalizer           2.1.0
cycler                       0.11.0
decorator                    5.1.1
distlib                      0.3.5
docopt                       0.6.2
filelock                     3.8.0
flatbuffers                  2.0
fonttools                    4.34.4
fpdf                         1.7.2
gast                         0.4.0
google-auth                  2.10.0
google-auth-oauthlib         0.4.6
google-pasta                 0.2.0
grpcio                       1.47.0
h5py                         3.7.0
hdfs                         2.7.0
idna                         3.3
joblib                       1.1.0
jsonschema                   4.9.1
keras                        2.9.0
Keras-Preprocessing          1.1.2
kiwisolver                   1.4.4
kneed                        0.8.1
libclang                     14.0.6
librosa                      0.9.2
llvmlite                     0.39.0
logger                       1.4
Markdown                     3.4.1
MarkupSafe                   2.1.1
matplotlib                   3.5.2
numba                        0.56.0
numpy                        1.22.0
oauthlib                     3.2.0
opt-einsum                   3.3.0
packaging                    21.3
pandas                       1.4.3
Pillow                       9.2.0
pip                          22.2.2
platformdirs                 2.5.2
pooch                        1.6.0
protobuf                     3.19.4
pyasn1                       0.4.8
pyasn1-modules               0.2.8
pycparser                    2.21
pyparsing                    3.0.9
pyrsistent                   0.18.1
python-dateutil              2.8.2
python-Levenshtein           0.12.2
pytz                         2022.1
PyYAML                       6.0
rdp                          0.8
requests                     2.28.1
requests-oauthlib            1.3.1
resampy                      0.4.0
rsa                          4.9
scikit-learn                 1.1.2
scipy                        1.9.0
seaborn                      0.11.2
setuptools                   63.4.3
six                          1.16.0
SoundFile                    0.10.3.post1
tensorboard                  2.9.1
tensorboard-data-server      0.6.1
tensorboard-plugin-wit       1.8.1
tensorflow                   2.10.0rc0
tensorflow-cpu-aws           2.10.0rc0
tensorflow-estimator         2.9.0
tensorflow-io-gcs-filesystem 0.26.0
termcolor                    1.1.0
threadpoolctl                3.1.0
typing_extensions            4.3.0
urllib3                      1.26.11
virtualenv                   20.16.3
watchdog                     2.1.9
Werkzeug                     2.2.2
wheel                        0.37.1
wrapt                        1.14.1

Moreover the packages kears, kneed, librosa, seaborn, sklearn and tensorflow also give the same error. I am not sure where and how to check the dependency of package version. May I know how can I know which versions are compatible with numpy version? Which versions should I install for those packages kears, kneed, librosa, seaborn, sklearn, tensorflow and numpy using pip install in miniconda3 .

Install gcc 12.1 via conda like this:

conda install gcc=12.1.0

Ensure that its libraries are in the library search path by setting the appropriate environment variable:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/miniconda3/lib

(using the lib of your specific conda environment may also work: $HOME/miniconda3/env/YOUR_ENV_NAME/lib )

Then start your Python script.

Actually the version `GLIBCXX_3.4.30' exists but not in the folder they are searching in. What you need to do is to find that folder by:

sudo find / -name "libstdc++.so.6*"

It will show you lots of files in the system, pick the largest one ie the one with "libstdc++.so.6.0.30" at the end. Check if it contains the version you're looking for by:

strings /usr/local/share/miniconda/envs/ffcv/lib/libstdc++.so.6.0.30 | grep GLIBCXX

If it's there, you need to copy it and delete the original one by:

sudo cp /usr/local/share/miniconda/pkgs/libstdcxx-ng-12.2.0-h46fd767_19/lib/libstdc++.so.6.0.30 /usr/lib/x86_64-linux-gnu/

sudo rm /usr/lib/x86_64-linux-gnu/libstdc++.so.6

sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30 /usr/lib/x86_64-linux-gnu/libstdc++.so.6

And there you are. Hope it helps..

This is what worked for me. It was looking in /usr/lib/aarch64-linux-gnu while the correct version was available at $HOME/anaconda3/lib.

You can use the following to ensure that it is available under anaconda3/lib

sudo find / -name "libstdc++.so.6.0.30"

To fix, update the environment variable with correct path

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/anaconda3/lib

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM