Skip to content

Fails to import with numpy 1.23.5 after compiling on raspbian arm with clang 13 for python 3.11 #22811

@jtoledo1974

Description

@jtoledo1974

Steps to reproduce:

Pip install build from source as there is no wheel for python 3.11

(homeassistant-shadow) homeassistant@lazaro:/srv/homeassistant-shadow$ pip install numpy
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting numpy
  Downloading numpy-1.23.5.tar.gz (10.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.7/10.7 MB 8.4 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: numpy
  Building wheel for numpy (pyproject.toml) ... done
  Created wheel for numpy: filename=numpy-1.23.5-cp311-cp311-linux_armv7l.whl size=10681800 sha256=38fff5fe9473a06d14419d01d7e1321906d59765930bd20be43ce30f42e282b6
  Stored in directory: /home/homeassistant/.cache/pip/wheels/32/6f/c1/c2fda686f19bc32d64822ae92e3dc4922f9a999c703d998abc
Successfully built numpy
Installing collected packages: numpy
Successfully installed numpy-1.23.5

Error message:

Traceback (most recent call last):
  File "/srv/homeassistant-shadow/lib/python3.11/site-packages/numpy/core/__init__.py", line 23, in <module>
    from . import multiarray
  File "/srv/homeassistant-shadow/lib/python3.11/site-packages/numpy/core/multiarray.py", line 10, in <module>
    from . import overrides
  File "/srv/homeassistant-shadow/lib/python3.11/site-packages/numpy/core/overrides.py", line 6, in <module>
    from numpy.core._multiarray_umath import (
ImportError: /srv/homeassistant-shadow/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-arm-linux-gnueabihf.so: undefined symbol: __mulodi4

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/srv/homeassistant-shadow/lib/python3.11/site-packages/numpy/__init__.py", line 140, in <module>
    from . import core
  File "/srv/homeassistant-shadow/lib/python3.11/site-packages/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 "/srv/homeassistant-shadow/bin/python"
  * The NumPy version is: "1.23.5"

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

Original error was: /srv/homeassistant-shadow/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-arm-linux-gnueabihf.so: undefined symbol: __mulodi4

Additional information:

Both python and numpy where compiled on the raspberry pi 4 running bullseye using clang-13

In particular, for compiling python the following was run

export CC=/usr/bin/clang-13
export CXX=/usrbin/clang++-13
export LDFLAGS=" -fuse-ld=lld"
ln -s /usr/bin/llvm-arm-13 /usr/local/bin/llv-arm
ln -s /usr/bin/llvm-profdata-13 /usr/local/bin/llvm-profdata

./configure --prefix /usr/local/cpython-3.11 --with-lto=full --enable-optimizations 

python -m test passes correctly.

The error showed up inside a venv created with the previously compiled and installed python 3.11.

I'm running another build to get the build log and will attach it when it's done.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions