1

I'm using Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-194-generic x86_64)

Everything worked fine and don't know what happened this error started to pop out.

$ python3 train.py
Traceback (most recent call last):
  File "/home/sivan/sub_center_one_class/train.py", line 22, in <module>
    from dataset import *
  File "/home/sivan/sub_center_one_class/dataset.py", line 9, in <module>
    import librosa
  File "/home/sivan/.conda/envs/speech/lib/python3.9/site-packages/librosa/__init__.py", line 209, in <module>
    from . import core
  File "/home/sivan/.conda/envs/speech/lib/python3.9/site-packages/librosa/core/__init__.py", line 5, in <module>
    from .convert import *  # pylint: disable=wildcard-import
  File "/home/sivan/.conda/envs/speech/lib/python3.9/site-packages/librosa/core/convert.py", line 7, in <module>
    from . import notation
  File "/home/sivan/.conda/envs/speech/lib/python3.9/site-packages/librosa/core/notation.py", line 8, in <module>
    from ..util.exceptions import ParameterError
  File "/home/sivan/.conda/envs/speech/lib/python3.9/site-packages/librosa/util/__init__.py", line 77, in <module>
    from .utils import *  # pylint: disable=wildcard-import
  File "/home/sivan/.conda/envs/speech/lib/python3.9/site-packages/librosa/util/utils.py", line 5, in <module>
    import scipy.ndimage
  File "/home/sivan/.conda/envs/speech/lib/python3.9/site-packages/scipy/ndimage/__init__.py", line 153, in <module>
    from ._interpolation import *  # noqa: F401 F403
  File "/home/sivan/.conda/envs/speech/lib/python3.9/site-packages/scipy/ndimage/_interpolation.py", line 37, in <module>
    from scipy import special
  File "/home/sivan/.conda/envs/speech/lib/python3.9/site-packages/scipy/__init__.py", line 211, in __getattr__
    return _importlib.import_module(f'scipy.{name}')
  File "/home/sivan/.conda/envs/speech/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/sivan/.conda/envs/speech/lib/python3.9/site-packages/scipy/special/__init__.py", line 657, in <module>
    from . import _orthogonal
  File "/home/sivan/.conda/envs/speech/lib/python3.9/site-packages/scipy/special/_orthogonal.py", line 81, in <module>
    from scipy import linalg
  File "/home/sivan/.conda/envs/speech/lib/python3.9/site-packages/scipy/__init__.py", line 211, in __getattr__
    return _importlib.import_module(f'scipy.{name}')
  File "/home/sivan/.conda/envs/speech/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/sivan/.conda/envs/speech/lib/python3.9/site-packages/scipy/linalg/__init__.py", line 209, in <module>
    from ._matfuncs import *
  File "/home/sivan/.conda/envs/speech/lib/python3.9/site-packages/scipy/linalg/_matfuncs.py", line 19, in <module>
    from ._matfuncs_sqrtm import sqrtm
  File "/home/sivan/.conda/envs/speech/lib/python3.9/site-packages/scipy/linalg/_matfuncs_sqrtm.py", line 24, in <module>
    from ._matfuncs_sqrtm_triu import within_block_loop
ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/sivan/.conda/envs/speech/lib/python3.9/site-packages/scipy/linalg/_matfuncs_sqrtm_triu.cpython-39-x86_64-linux-gnu.so)

$ strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_DEBUG_MESSAGE_LENGTH

$ ldd --version 
ldd (Ubuntu GLIBC 2.27-3ubuntu1.5) 2.27

It seems like the problem of importing librosa. But I tried this and there's no error.

$ python
>> import librosa

But! there will be errors if I import torch first.... And no errors if it's the other way around, import librosa first then torch....

$ python
>> import torch
>> import librosa
>> ImportError

I also tried using PyCharm with the same interpreter and it also works with no errors. So problems only appear when I use terminal to run the code....

Really need some help here. Thanks!

Sivan D
  • 61
  • 6
  • Perhaps https://stackoverflow.com/a/73788315/942774 helps. – Hendrik Oct 18 '22 at 00:36
  • what OS, what OS version, did you install scipy via pip or conda? – Andrew Nelson Oct 19 '22 at 08:05
  • @andrew I'm using Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-194-generic x86_64) scipy is installed by pip – Sivan D Oct 19 '22 at 16:58
  • When scipy is built it has to be linked against glibcxx. That link step is typically done using a `manylinux2014` docker image based on CentOS 7 x86_64. This [page](https://peps.python.org/pep-0599/) states that a manylinux2014 compliant binary can't use a version symbols later than GLIBCXX_3.4.19. IIUC the binary you have links with symbols that are too modern. Which scipy wheel file is installed, where did you get it from? The fact that Pycharm environment works, but terminal doesn't suggests that a more recent glibcxx is somehow available to Pycharm, but not to your terminal environment. – Andrew Nelson Oct 20 '22 at 02:20
  • What is the output of `ldd /home/sivan/.conda/envs/speech/lib/python3.9/site-packages/scipy/linalg/_matfuncs_sqrtm_triu.cpython-39-x86_64-linux-gnu.so`? – Andrew Nelson Oct 20 '22 at 02:32
  • Actually can you tell me: `ldd -v /home/sivan/.conda/envs/speech/lib/python3.9/site-packages/scipy/linalg/_matfuncs_sqrtm_triu.cpython-39-x86_64-linux-gnu.so`? When I do that on scipy-1.9.2 or scipy-1.7.3 `libstdc++` is not listed as a dynamic library to load by that shared library. – Andrew Nelson Oct 20 '22 at 04:39

0 Answers0