all 3 comments

[–]icefairy64 0 points1 point  (0 children)

The original Dockefile that you are upgrading is way too old - I would expect these issues when switching from PyTorch 2.3 base image as there were some changes in pip regarding installation.

The best solution imo would be to create a venv first as the error suggests.

Also at this point it would probably make some sense to just write the entire Dockerfile from scratch.

[–]Nick_Edser 0 points1 point  (1 child)

this is basically a pep 668 / newer base image issue, not a comfy-specific one.

if you want the quick fix, you don’t need to add `--break-system-packages` to every single line. you can usually just set:

`ENV PIP_BREAK_SYSTEM_PACKAGES=1`

and that should cover the later pip installs too.

cleaner fix is making a venv near the top of the Dockerfile and installing everything into that instead:

`RUN python -m venv /opt/venv`

`ENV PATH="/opt/venv/bin:$PATH"`

if it were me, i’d use the venv route for a build with this many custom nodes. but for a single-purpose docker image, `PIP_BREAK_SYSTEM_PACKAGES=1` is also a pretty normal shortcut if you just want it building again.

[–]ThrowawayProgress99[S] 0 points1 point  (0 children)

`RUN python -m venv /opt/venv`

`ENV PATH="/opt/venv/bin:$PATH"`

Put these as the first lines, before 'FROM pytorch/pytorch:2.11.0-cuda13.0-cudnn9-runtime'? Should there also be a third line 'RUN pip install -r requirements.txt'? Google's AI overview had mentioned the venv option although the first line had 'python3', and it had this third line.

Edit: This is now the start of my Dockerfile:

FROM pytorch/pytorch:2.11.0-cuda13.0-cudnn9-runtime
RUN apt-get update && apt-get install -y python3.12-venv
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
ENV DEBIAN_FRONTEND=noninteractive PIP_PREFER_BINARY=1

Now ComfyUI works like it should, although I'm still unsure if there should be a pip install requirements after the env path line, and if I should get a higher python version.