Alpine Linux support
Pavel-Konarik opened this issue ยท 15 comments
Is your feature request related to a problem? Please describe.
onnxruntime-1.1.1-cp36-cp36m-manylinux1_x86_64.whl is not supported on Alpine 3.11
System information
- ONNX Runtime version (you are using):
1.1.1
Describe the solution you'd like
Include support for Alpine Linux in manylinux wheel so pip install onnxruntime
works
Describe alternatives you've considered
Building from source
Additional context
ERROR: onnxruntime-1.1.1-cp36-cp36m-manylinux1_x86_64.whl is not a supported wheel on this platform.
Any hint what we should do?
Sadly I am not sure why manylinux for onnxruntime does not include support for Alpine Linux, but here are steps to quickly reproduce the error and some additional info.
Why Alpine Linux?
I am building a simple and small predictor in Docker, and alpine has much smaller image than Ubuntu
Does installing onnx give the same error?
No, pip install onnx
works as intended
Steps to replicate
#Dockerfile
FROM python:3.6.10-alpine3.11
RUN apk --no-cache add wget build-base gcc git cmake gfortran musl-dev bash bash-doc bash-completion freetype-dev &&\
apk --no-cache add jpeg-dev zlib-dev make && pip --version && pip install --upgrade pip
RUN pip install onnx==1.6.0 onnxruntime==1.1.1
Build Docker image using
docker build -t onnximage -f <Dockerfile path> .
Python version
Python 3.6.10
I am happy to provide/try anything. At the moment I am trying to compile from source.
Unfortunately, manylinux
wheels are not compatible with Alpine Linux. In fact, Alpine Linux and musl based distros are not currently not supported by python wheels:
pypa/manylinux#37
Alpine is based on musl libc, as opposed glibc, the GNU standard C library, which is used by most Linux distros and supported by manylinux
. musl is a minimalistic and novel libc implementation, and as such misses many glibc features. In addition, there are subtle functional differences (such as smaller default thread stack size, dynamic linking behavior, locales implementation, etc.).
Detailed musl/glibc comparisons could be found here:
- Comparison of C/POSIX standard library implementations for Linux (ETA Labs)
- Functional differences from glibc (musl-libc.org, archived)
Until Alpine Linux wheel support is added, installing wheels on Alpine will have to fall back to building the wheel from source, which will probably require support in the onnxruntime
wheel build script.
FYI, I created a docker image for building onnxruntime from source on Alpine 3.11 (python 3.8.2, gcc 9.2.0) - perhaps it could be useful: Dockerfile. Some minor tweaking was required to overcome some build and dependency issues, but besides that the C++ build itself was very smooth.
@shaharv Thanks for the amazing explanation and the Dockerfile! You rock!
@Pavel-Konarik: May I suggest you reopen this issue, and take a look at pypa/manylinux#37 (comment)?
Once we get musl support from pypa/manylinux, cibuildwheel and auditwheel tools, I can help add it to our packaging pipeline.
auditwheel 5.0.0 added musl support on 2021-09-18 (also manylinux), cibuildwheel 2.2.0 did so on 2021-10-22.
any update on this? still failed
Sorry the work is not started yet.
Hello, any update on this? I met similar problem on Alpine Linux to deploy ML on java server
+1
Facing exactly this same issue in alpine docker image running my java server app.
ldd libonnxruntime.so
/lib/ld-musl-x86_64.so.1 (0x4000000000)
libdl.so.2 => /lib/ld-musl-x86_64.so.1 (0x4000000000)
librt.so.1 => /lib/ld-musl-x86_64.so.1 (0x4000000000)
libpthread.so.0 => /lib/ld-musl-x86_64.so.1 (0x4000000000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x400271f000)
libm.so.6 => /lib/ld-musl-x86_64.so.1 (0x4000000000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x40028f7000)
libc.so.6 => /lib/ld-musl-x86_64.so.1 (0x4000000000)
ld-linux-x86-64.so.2 => /lib/ld-linux-x86-64.so.2 (0x4002910000)
Error relocating libonnxruntime.so: __snprintf_chk: symbol not found
Error relocating libonnxruntime.so: __vsnprintf_chk: symbol not found
Error relocating libonnxruntime.so: __memset_chk: symbol not found
Error relocating libonnxruntime.so: __fprintf_chk: symbol not found
Error relocating libonnxruntime.so: __memcpy_chk: symbol not found
We don't have prebuilt packages for Alpine. At this moment you still need to build it by yourself. People I know in this dev team do not have experience on Alpine, so we don't know how to do it.
See testing/onnxruntime, testing/onnxruntime-dev and testing/py3-onnxruntime are now available.
See testing/onnxruntime, testing/onnxruntime-dev and testing/py3-onnxruntime are now available.
Excellent news. I installed these packages on a postmarketOS phone, added Larynx and get very good speech output from this text-to-speech system.
Maybe someone can close this issue?
Hello, any update on this? I met similar problem on Alpine Linux to deploy ML on java server
+1