0

I'm attempting to build a crate within a docker container, which depends on the inline-python crate.

The docker file looks like this:

# syntax=docker/dockerfile:1
FROM pytorch/pytorch:2.0.0-cuda11.7-cudnn8-runtime

ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Install dependencies
RUN apt-get update && \
    apt-get install -y curl unzip sudo build-essential libssl-dev pkg-config git && \
    rm -rf /var/lib/apt/lists/*

# Install Rust & Cargo
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly && \
    echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc && \
    . ~/.bashrc && \
    rustup update


# Update PATH to include Cargo
ENV PATH="/root/.cargo/bin:$PATH"

WORKDIR /app
COPY ./app /app

RUN cd /app && cargo clean
RUN rm -rf ~/.cargo/registry/

# Fetch and build in separate steps, so that the fetch step can be cached
RUN cd /app && cargo fetch
RUN cd /app && cargo build

Docker fails on the cargo build step with the following error:

#28 280.5    Compiling inline-python v0.10.0
#28 280.6 <jemalloc>: MADV_DONTNEED does not work (memset will be used instead)
#28 280.6 <jemalloc>: (This is the expected behaviour if you are running under QEMU)
#28 280.9 error[E0519]: the current crate is indistinguishable from one of its dependencies: it has the same crate-name `inline_python_macros` and was compiled with the same `-C metadata` arguments. This will result in symbol conflicts between the two.
#28 280.9    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/inline-python-0.10.0/src/lib.rs:138:9
#28 280.9     |
#28 280.9 138 | pub use inline_python_macros::python;
#28 280.9     |         ^^^^^^^^^^^^^^^^^^^^
#28 280.9 
#28 281.5 For more information about this error, try `rustc --explain E0519`.
#28 281.5 error: could not compile `inline-python` (lib) due to previous error
#28 281.5 warning: build failed, waiting for other jobs to finish...
#28 ERROR: executor failed running [/bin/sh -c cd /app/sd_worker && cargo build]: exit code: 101
------
 > [20/21] RUN cd /app && cargo build:
------
executor failed running [/bin/sh -c cd /app && cargo build]: exit code: 101

Previously I was able to compile this crate successfully, a few days ago. All that I changed was the base image.

It seems like the issue is in the inline_python crate itself, so it is surprising that the base image would have any impact on its ability to compile.

The dependency is included like so in my Cargo.toml:

[dependencies]
inline-python = "0.10"

How can I resolve this error?

sak
  • 2,612
  • 24
  • 55

0 Answers0