Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust bindings in Docker on M1 #739

Open
kakserpom opened this issue Jun 15, 2024 · 2 comments
Open

Rust bindings in Docker on M1 #739

kakserpom opened this issue Jun 15, 2024 · 2 comments

Comments

@kakserpom
Copy link

Hey!
What a great project.
Can you please update Rust bindings?

There is no aarch64 image for build_rust

An attempt to build https://github.com/undertheseanlp/underthesea/blob/d8d215943d0b39d525802429a7624b87be128991/extensions/docker/build-image/Dockerfile:

 => ERROR [underthesea  6/27] RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh &&     wget --quiet https://repo.anaconda  27.5s
------
 > [underthesea  6/27] RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh &&     wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh -O ~/miniconda.sh &&     /bin/bash ~/miniconda.sh -b -p /opt/conda &&     rm ~/miniconda.sh:
24.50 PREFIX=/opt/conda
24.90 installing: python-3.7.0-hc3d631a_0 ...
27.36 rosetta error: failed to open elf at /lib64/ld-linux-x86-64.so.2
27.36  /root/miniconda.sh: line 355:    35 Trace/breakpoint trap   "$PREFIX/pkgs/python-3.7.0-hc3d631a_0/bin/python" -E -s "$PREFIX"/pkgs/.install.py $INST_OPT --root-prefix="$PREFIX" --link-dist="$1"
------
failed to solve: process "/bin/sh -c echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh &&     wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh -O ~/miniconda.sh &&     /bin/bash ~/miniconda.sh -b -p /opt/conda &&     rm ~/miniconda.sh" did not complete successfully: exit code: 1
@kakserpom kakserpom changed the title Rust bindings in Docker Rust bindings in Docker on M1 Jun 15, 2024
@rain1024
Copy link
Contributor

@kakserpom Yes, this image is only for building underthesea on Linux. For Mac ARM, we actually use self-hosted GitHub Actions (see https://github.com/undertheseanlp/underthesea/blob/main/.github/workflows/release-pypi-core.yml#L145)

@kakserpom
Copy link
Author

kakserpom commented Jun 22, 2024

It didn't work on Linux either.

FROM alpine:3.19
ENV PIP_ROOT_USER_ACTION=ignore
# Install required packages
RUN apk add --no-cache \
    python3 \
    python3-dev \
    py3-pip \
    curl \
    build-base \
    pkgconfig \
    openssl-dev \
    # libressl-dev \
    bash \
    rust \
    cargo \
    py3-scikit-learn && \
    pip3 install --break-system-packages maturin patchelf
# Install underthesea_core
RUN curl -O
https://files.pythonhosted.org/packages/b3/7f/8d136185263619e25473af7584bb224918a3546975afeb375b87b3bcae20/underthesea_core-1.0.4.tar.gz
&& \
    tar -xvf underthesea_core-1.0.4.tar.gz && \
    rm underthesea_core-1.0.4.tar.gz && \
    cd underthesea_core-1.0.4 && \
    maturin build && \
    pip3 install --break-system-packages target/wheels/*.whl
# Install underthesea_core
RUN pip install --break-system-packages underthesea

RUN pip install --break-system-packages
https://github.com/kakserpom/fastText/archive/main.zip

COPY server.py .
CMD [ "python3", "server.py"]

Here is a working Dockerfile.
It works on both Linux and Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants