You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Graalpy not work with numpy in static-linked native-image #464
Greetings!!
Graalpy is a wonderful work! You guys are brilliant!! It helped me a lot!
i've been trying to use graalpy in static-linkednative-image, basic python functions are completely working perfectly.
but when it comes to numpy , it seems graalpy cannot work properly in static-linked NI.
everytime it runs into numpy code, a error occurs:
Traceback (most recent call last):
File "Unnamed", line 3, in <module>
File "/graalpy_vfs/venv/lib/python3.11/site-packages/numpy/__init__.py", line 141, in <module>
from . import core
File "/graalpy_vfs/venv/lib/python3.11/site-packages/numpy/core/__init__.py", line 23, in <module>
from . import multiarray
File "/graalpy_vfs/venv/lib/python3.11/site-packages/numpy/core/multiarray.py", line 10, in <module>
from . import overrides
File "/graalpy_vfs/venv/lib/python3.11/site-packages/numpy/core/overrides.py", line 6, in <module>
from numpy.core._multiarray_umath import (
SystemError: NFIUnsatisfiedLinkError: Dynamic loading not supported
according to the stacks, i found that the _multiarray_umath is provided with a dynamic lib file.
is it possilble to run numpy code in a static NI with graalpy now?
changed the title [-]Graalpy not work with static-linked native-image[/-][+]Graalpy not work with numpy in static-linked native-image[/+]on Dec 24, 2024
Hi @buuuuuuug, unfortunately it's not possible. Python native extensions are compiled as dynamic modules and dynamic module loading can't work with a static libc. That's not specific to GraalPy, statically linked CPython would also not be able to load numpy installed as a module. What might work is mostly-static image with dynamically linked glibc (documentation), but then it would still load the modules and their dependencies as dynamic, which would kinda defeat the purpose of static linking.
Activity
[-]Graalpy not work with static-linked native-image[/-][+]Graalpy not work with numpy in static-linked native-image[/+]msimacek commentedon Jan 2, 2025
Hi @buuuuuuug, unfortunately it's not possible. Python native extensions are compiled as dynamic modules and dynamic module loading can't work with a static libc. That's not specific to GraalPy, statically linked CPython would also not be able to load numpy installed as a module. What might work is mostly-static image with dynamically linked glibc (documentation), but then it would still load the modules and their dependencies as dynamic, which would kinda defeat the purpose of static linking.