Error build Dockerfile api #4180

Closed
opened 2026-02-21 18:05:05 -05:00 by yindo · 9 comments
Owner

Originally created by @tienld-0801 on GitHub (Jun 19, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.11

Cloud or Self Hosted

Cloud, Self Hosted (Docker), Self Hosted (Source)

Steps to reproduce

Screenshot 2024-06-20 at 01 29 59

✔️ Expected Behavior

It seems like the python version does not match and the pip install command cannot be run

Actual Behavior

No response

Originally created by @tienld-0801 on GitHub (Jun 19, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.11 ### Cloud or Self Hosted Cloud, Self Hosted (Docker), Self Hosted (Source) ### Steps to reproduce <img width="1256" alt="Screenshot 2024-06-20 at 01 29 59" src="https://github.com/langgenius/dify/assets/112608271/e8bb88d8-85c3-4220-9ffb-5345f68d497d"> ### ✔️ Expected Behavior It seems like the python version does not match and the pip install command cannot be run ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug🤔 cant-reproduce labels 2026-02-21 18:05:05 -05:00
yindo closed this issue 2026-02-21 18:05:05 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jun 19, 2024):

To resolve the milvus-lite package version compatibility issue when building a Dockerfile for an API using the Python 3.10 slim-bookworm base image, you should upgrade pip as suggested by the terminal output. Here is the modified Dockerfile:

# base image
FROM python:3.10-slim-bookworm AS base

LABEL maintainer="takatost@gmail.com"

# install packages
FROM base as packages

RUN apt-get update \
    && apt-get install -y --no-install-recommends gcc g++ libc-dev libffi-dev libgmp-dev libmpfr-dev libmpc-dev

# Upgrade pip to the latest version
RUN --mount=type=cache,target=/root/.cache/pip \
    pip install --upgrade pip

COPY requirements.txt /requirements.txt

RUN --mount=type=cache,target=/root/.cache/pip \
    pip install --prefix=/pkg -r requirements.txt

# production stage
FROM base AS production

ENV FLASK_APP app.py
ENV EDITION SELF_HOSTED
ENV DEPLOY_ENV PRODUCTION
ENV CONSOLE_API_URL http://127.0.0.1:5001
ENV CONSOLE_WEB_URL http://127.0.0.1:3000
ENV SERVICE_API_URL http://127.0.0.1:5001
ENV APP_WEB_URL http://127.0.0.1:3000

EXPOSE 5001

# set timezone
ENV TZ UTC

WORKDIR /app/api

RUN apt-get update \
    && apt-get install -y --no-install-recommends curl wget vim nodejs ffmpeg libgmp-dev libmpfr-dev libmpc-dev \
    && apt-get autoremove \
    && rm -rf /var/lib/apt/lists/*

COPY --from=packages /pkg /usr/local
COPY . /app/api/

COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ARG COMMIT_SHA
ENV COMMIT_SHA ${COMMIT_SHA}

ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]

By adding the pip install --upgrade pip command, you ensure that pip is upgraded to the latest version, which should help resolve the compatibility issue with the milvus-lite package [1].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jun 19, 2024): <!-- Answer --> To resolve the `milvus-lite` package version compatibility issue when building a Dockerfile for an API using the Python 3.10 slim-bookworm base image, you should upgrade `pip` as suggested by the terminal output. Here is the modified Dockerfile: ```dockerfile # base image FROM python:3.10-slim-bookworm AS base LABEL maintainer="takatost@gmail.com" # install packages FROM base as packages RUN apt-get update \ && apt-get install -y --no-install-recommends gcc g++ libc-dev libffi-dev libgmp-dev libmpfr-dev libmpc-dev # Upgrade pip to the latest version RUN --mount=type=cache,target=/root/.cache/pip \ pip install --upgrade pip COPY requirements.txt /requirements.txt RUN --mount=type=cache,target=/root/.cache/pip \ pip install --prefix=/pkg -r requirements.txt # production stage FROM base AS production ENV FLASK_APP app.py ENV EDITION SELF_HOSTED ENV DEPLOY_ENV PRODUCTION ENV CONSOLE_API_URL http://127.0.0.1:5001 ENV CONSOLE_WEB_URL http://127.0.0.1:3000 ENV SERVICE_API_URL http://127.0.0.1:5001 ENV APP_WEB_URL http://127.0.0.1:3000 EXPOSE 5001 # set timezone ENV TZ UTC WORKDIR /app/api RUN apt-get update \ && apt-get install -y --no-install-recommends curl wget vim nodejs ffmpeg libgmp-dev libmpfr-dev libmpc-dev \ && apt-get autoremove \ && rm -rf /var/lib/apt/lists/* COPY --from=packages /pkg /usr/local COPY . /app/api/ COPY docker/entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ARG COMMIT_SHA ENV COMMIT_SHA ${COMMIT_SHA} ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] ``` By adding the `pip install --upgrade pip` command, you ensure that `pip` is upgraded to the latest version, which should help resolve the compatibility issue with the `milvus-lite` package <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/Dockerfile)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Jun 19, 2024):

We have updated this API dockerfile for over 3 months, so if this generates errors, you won't be able to see the v0.6.11.

@crazywoola commented on GitHub (Jun 19, 2024): We have updated this API dockerfile for over 3 months, so if this generates errors, you won't be able to see the v0.6.11.
Author
Owner

@tienld-0801 commented on GitHub (Jun 19, 2024):

@crazywoola Because I update over time, while updating the v0.6.11 api folder, there was a change in the lib that caused me to get a wrong version number. Surely the Dockerfile is not responsive enough.

@tienld-0801 commented on GitHub (Jun 19, 2024): @crazywoola Because I update over time, while updating the v0.6.11 api folder, there was a change in the lib that caused me to get a wrong version number. Surely the Dockerfile is not responsive enough.
Author
Owner

@crazywoola commented on GitHub (Jun 19, 2024):

I guess you need to try to use the latest poetry to install dependencies.

@crazywoola commented on GitHub (Jun 19, 2024): I guess you need to try to use the latest poetry to install dependencies.
Author
Owner

@bowenliang123 commented on GitHub (Jun 19, 2024):

Which system and chip architecture are you using? Is that Linux on arm64?

@bowenliang123 commented on GitHub (Jun 19, 2024): Which system and chip architecture are you using? Is that Linux on arm64?
Author
Owner

@crazywoola commented on GitHub (Jun 19, 2024):

image

After upgrading to 2.4, Milvus cannot successfully install dependencies on the ARM architecture of Linux. Therefore, if you want to proceed with the use of Poetry/mirror construction, you might need to consider rolling back Milvus.

@crazywoola commented on GitHub (Jun 19, 2024): <img width="1246" alt="image" src="https://github.com/langgenius/dify/assets/100913391/a1957eba-9cde-4a30-9e82-b065fc495cde"> After upgrading to 2.4, Milvus cannot successfully install dependencies on the ARM architecture of Linux. Therefore, if you want to proceed with the use of Poetry/mirror construction, you might need to consider rolling back Milvus.
Author
Owner

@tienld-0801 commented on GitHub (Jun 20, 2024):

@bowenliang123 I'm using macos m3 and want to build arm64 and amd64 but I get an error .

@tienld-0801 commented on GitHub (Jun 20, 2024): @bowenliang123 I'm using macos m3 and want to build arm64 and amd64 but I get an error .
Author
Owner

@bowenliang123 commented on GitHub (Jun 20, 2024):

Please rebase to latest commit of the master branch and try again.
As #5414 reverted the #3795, the pymilvus is now downgraded to 2.3.x, which does not requires milvus-lite pakcage.

@bowenliang123 commented on GitHub (Jun 20, 2024): Please rebase to latest commit of the master branch and try again. As #5414 reverted the #3795, the `pymilvus` is now downgraded to 2.3.x, which does not requires `milvus-lite` pakcage.
Author
Owner

@tienld-0801 commented on GitHub (Jun 22, 2024):

@crazywoolala , @bowenliang123 I confirm the patch works fine, so I consider closing this issue

@tienld-0801 commented on GitHub (Jun 22, 2024): @crazywoolala , @bowenliang123 I confirm the patch works fine, so I consider closing this issue
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4180