4

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.

Susan
  • 431
  • 1
  • 4
  • 16
  • is that try to compile from source code? if yes, you can call CXX environment run `./configure --prefix=/home/$user/python3.10 CXX=aarch64-linux-gnu-g++ make -j8` – abu-ahmed al-khatiri Aug 11 '22 at 09:13
  • No I try to import all the installed packages in the miniconda3 – Susan Aug 11 '22 at 09:20
  • on pip you can install it `pip3 install kneed` and on conda you can install it `conda install -c conda-forge kneed` – abu-ahmed al-khatiri Aug 11 '22 at 09:25
  • in my linux, after installing kneed with pip3, I checked import kneed. There is no issue. But when I exit the python and import kneed again, I got ```ImportError: /usr/lib/aarch64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /home/odroid/miniconda3/envs/acousticpdev/lib/python3.10/site-packages/scipy/fft/_pocketfft/pypocketfft.cpython-310-aarch64-linux-gnu.so)``` – Susan Aug 11 '22 at 09:33
  • how about `conda install -c conda-forge kneed` – abu-ahmed al-khatiri Aug 11 '22 at 09:49
  • the simple way is try to check on your project library, run `ls /home/$user/to/yourproject/lib/libstdc++.so.6.0.30`, if there you can linker it, run `rm /usr/lib/aarch64-linux-gnu/libstdc++.so.6 && cp /home/$user/to/yourproject/lib/libstdc++.so.6.0.30 /usr/lib/aarch64-linux-gnu/ && ln -s /usr/lib/aarch64-linux-gnu/libstdc++.so.6.0.30 /usr/lib/aarch64-linux-gnu/libstdc++.so.6` – abu-ahmed al-khatiri Aug 11 '22 at 10:15
  • 1
    Please do not do what @abu-ahmedal-khatiri just commented, this command will remove libstdc++ which is very dangerous to do! Do not ever delete system libraries like this, you do not know what effect will it have on your system, you could completely break the OS. – Dr. Snoopy Aug 11 '22 at 12:45
  • 1
    @Dr.Snoopy with new library linker, is that will break the system sir? please how to get the latest glibc for help the OP? if you purge all the python aptitude that will completely break the OS. Thanks. – abu-ahmed al-khatiri Aug 11 '22 at 13:03
  • 1
    Deleting libstdc++ might break the system, it is the standard c++ library and it should never be touched by the user, only update it as part of the system with its package manager, not manually. – Dr. Snoopy Aug 11 '22 at 13:24
  • 1
    @Dr.Snoopy Perhaps you're right sorry my bad research, this thread https://stackoverflow.com/q/72540359/10118354 already same case with the OP's question. to ensure to get the latest gcc, run `conda install -c conda-forge gcc=12.1.0`. – abu-ahmed al-khatiri Aug 11 '22 at 16:37
  • Thank you for the reply. The issue is solved. – Susan Aug 11 '22 at 17:43
  • @Dr.Snoopy, "Please do not do what abu-ahmedal-khatiri just commented, this command will remove libstdc++ which is very dangerous to do! " may I know which command are you referring to? Because I am not sure whether I did it or not. – Susan Aug 11 '22 at 17:46
  • @Susan The "rm /usr/lib/aarch64-linux-gnu/libstdc++.so.6", never do this. – Dr. Snoopy Aug 11 '22 at 19:26
  • I got it. Thank you for input. @Dr.Snoopy – Susan Aug 12 '22 at 02:52

3 Answers3

6

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 i.e. 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..

4

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.

Hendrik
  • 5,085
  • 24
  • 56
1

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
blue-zircon
  • 186
  • 1
  • 7