Skip to content

Error from "import numpy": undefined symbol: _ZSt21__glibcxx_assert_failPKciS0_S0_ #23595

@cmarmo

Description

@cmarmo

Steps to reproduce:

I am compiling numpy from source (main 1.25.0.dev0+1173.g7f682bca5) on Fedora 37.

  • Python 3.11
  • GNU C Library (GNU libc) stable release version 2.36.
  • g++ (GCC) 12.2.1 20220819 (Red Hat 12.2.1-2)

I am compiling in a python venv, the C and C++ libraries are from the Fedora distribution.

$ pip install -e .

The compilation went well, but when importing from the python console:

>>> import numpy

the following error is thrown

Error message:

Traceback (most recent call last):
  File "/home/cmarmo/software/numpy/numpy/core/__init__.py", line 23, in <module>
    from . import multiarray
  File "/home/cmarmo/software/numpy/numpy/core/multiarray.py", line 10, in <module>
    from . import overrides
  File "/home/cmarmo/software/numpy/numpy/core/overrides.py", line 8, in <module>
    from numpy.core._multiarray_umath import (
ImportError: /home/cmarmo/software/numpy/numpy/core/_multiarray_umath.cpython-311-x86_64-linux-gnu.so: undefined symbol: _ZSt21__glibcxx_assert_failPKciS0_S0_

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/cmarmo/software/numpy/numpy/__init__.py", line 139, in <module>
    from . import core
  File "/home/cmarmo/software/numpy/numpy/core/__init__.py", line 49, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.11 from "/home/cmarmo/numpydevenv/bin/python"
  * The NumPy version is: "1.25.0.dev0+1173.g7f682bca5"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: /home/cmarmo/software/numpy/numpy/core/_multiarray_umath.cpython-311-x86_64-linux-gnu.so: undefined symbol: _ZSt21__glibcxx_assert_failPKciS0_S0_

Additional information:

I have upgraded and downgraded the libstdc++ as far as possible in fedora37, but the error is still there.
I have compiled with meson too and the result is the same.
I don't know if the issue is from numpy or the fedora packaging, but on the mailing list I have been suggested to open an issue here as apparently this behavior is reproducible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    32 - InstallationProblems installing or compiling NumPy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions