-
Notifications
You must be signed in to change notification settings - Fork 101
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
How to use with docker #449
Comments
Try using |
I tried that, and still get the same error |
Does your build stage have an amd64 image available? Last I saw docker's platforming just fails silently when there's no matching platform, which is annoying. Can you share a minimal repro dockerfile? |
I'm doing this and works (maybe there's a better way that'll remove the need to manually install rust, also the rust install part is just copied from the official image repo) FROM python:3.11.6-slim
# Install Rust
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.79.0
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
libc6-dev \
wget \
; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='6aeece6993e902708983b209d04c0d1dbb14ebb405ddb87def578d41f920f56d' ;; \
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='3c4114923305f1cd3b96ce3454e9e549ad4aa7c07c03aec73d1a785e98388bed' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='1cffbf51e63e634c746f741de50649bbbcbd9dbe1de363c9ecef64e278dba2b2' ;; \
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='0a6bed6e9f21192a51f83977716466895706059afb880500ff1d0e751ada5237' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
url="https://static.rust-lang.org/rustup/archive/1.27.1/${rustArch}/rustup-init"; \
wget "$url"; \
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version; \
apt-get remove -y --auto-remove \
wget \
; \
rm -rf /var/lib/apt/lists/*;
RUN pip install maturin
WORKDIR /tmp
COPY ./ ./
RUN maturin build --release
RUN pip install /tmp/target/wheels/*.whl
CMD ["python"] # I can run the image in a container and have my library available from the REPL Now, the real thing: FROM python:3.11.6-slim as rust-deps
# ... same logic as before except for the install of the package.
FROM bitnami/pytorch:2.1.1 as runtime
WORKDIR /app
COPY --from=rust-deps /tmp/target/wheels/*.whl /app/wheels/
RUN pip install --no-cache-dir /app/wheels/*.whl
CMD ["python"] this second image I run it with |
And you're saying that |
(Note I added |
|
Ok great, so it seems pretty clear that the docker I think the next thing to try would be the manylinux version. The |
yes, the versions differ from each other, thanks for the tip, if there a way to specify on |
I think the problem is that maturin can't guarantee the build artefacts haven't linked against functionality in the newer glibc. The simplest solution might be to use one of the manylinux images as the base of your build image instead of |
Hi, I have a package in rust using PyO3 that I need to build inside a docker container as part of a multi-stage build and pass it to the
runtime
stage for install and execution (I have this cumbersome setup as a requirement). I tried to usematurin
by runningmaturin build --release
but in theruntime
stage when I try to usepip install my-package-0.1.0-cp311-cp311-manylinux_2_34_aarch64.whl
I get this error:ERROR: my-package-0.1.0-cp311-cp311-manylinux_2_34_aarch64.whl is not a supported wheel on this platform
. The python version in which I'm building the wheel is 3.11.6 and it's the same version used in theruntime
. The theruntime
is running from bitnami/pytorch:2.1.1, I whould appretiate any advice to setup the Dockerfile to make this.PS: Sorry if I'm not more precise in the description, but I'm bounded by an NDA agreement.
The text was updated successfully, but these errors were encountered: