InvokeAI icon indicating copy to clipboard operation
InvokeAI copied to clipboard

[bug]: apt-get install steps in Dockerfile fail with "Package 'X' is not available"

Open briancaffey opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

OS

Linux

GPU

cuda

VRAM

24GB

What version did you experience this issue on?

257e9725

What happened?

I'm trying to build the docker image. My computer is using Ubuntu 22.04 with docker (version 24.0.2, build cb74dfc)

I'm seeing an error on the first apt-get install step:

 => ERROR [python-base 3/4] RUN   --mount=type=cache,target=/var/cache/apt,sharing=locked   --mount=type=cache,target=/var/lib/apt  1.7s
------                                                                                                                                   
 > [python-base 3/4] RUN   --mount=type=cache,target=/var/cache/apt,sharing=locked   --mount=type=cache,target=/var/lib/apt,sharing=locked   apt-get update   && apt-get install -y     --no-install-recommends     libgl1-mesa-glx=20.3.*     libglib2.0-0=2.66.*     libopencv-dev=4.5.*:
#0 0.555 Get:1 http://deb.debian.org/debian bookworm InRelease [147 kB]
#0 0.581 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
#0 0.657 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
#0 0.668 Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8904 kB]
#0 1.043 Get:5 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [28.3 kB]
#0 1.409 Fetched 9180 kB in 1s (9322 kB/s)
#0 1.409 Reading package lists...
#0 1.642 Reading package lists...
#0 1.648 Building dependency tree...
#0 1.693 Package libglib2.0-0 is not available, but is referred to by another package.
#0 1.693 This may mean that the package is missing, has been obsoleted, or
#0 1.693 is only available from another source
#0 1.693 
#0 1.693 Package libgl1-mesa-glx is not available, but is referred to by another package.
#0 1.693 This may mean that the package is missing, has been obsoleted, or
#0 1.693 is only available from another source
#0 1.693 
#0 1.693 Package libopencv-dev is not available, but is referred to by another package.
#0 1.693 This may mean that the package is missing, has been obsoleted, or
#0 1.693 is only available from another source
#0 1.693 
#0 1.694 E: Version '20.3.*' for 'libgl1-mesa-glx' was not found
#0 1.694 E: Version '2.66.*' for 'libglib2.0-0' was not found
#0 1.694 E: Version '4.5.*' for 'libopencv-dev' was not found
------
Dockerfile:16
--------------------
  15 |     # Install dependencies
  16 | >>> RUN \
  17 | >>>   --mount=type=cache,target=/var/cache/apt,sharing=locked \
  18 | >>>   --mount=type=cache,target=/var/lib/apt,sharing=locked \
  19 | >>>   apt-get update \
  20 | >>>   && apt-get install -y \
  21 | >>>     --no-install-recommends \
  22 | >>>     libgl1-mesa-glx=20.3.* \
  23 | >>>     libglib2.0-0=2.66.* \
  24 | >>>     libopencv-dev=4.5.*
  25 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c apt-get update   && apt-get install -y     --no-install-recommends     libgl1-mesa-glx=20.3.*     libglib2.0-0=2.66.*     libopencv-dev=4.5.*" did not complete successfully: exit code: 100

If I remove =x.x.* version specifiers from the command, I'm able to install the packages:

# Install dependencies
RUN \
  --mount=type=cache,target=/var/cache/apt,sharing=locked \
  --mount=type=cache,target=/var/lib/apt,sharing=locked \
  apt-get update \
  && apt-get install -y \
    --no-install-recommends \
    libgl1-mesa-glx \
    libglib2.0-0 \
    libopencv-dev

I tried looking up the most recent versions of these packages and using the full version, but this also failed:

# Install dependencies
RUN \
  --mount=type=cache,target=/var/cache/apt,sharing=locked \
  --mount=type=cache,target=/var/lib/apt,sharing=locked \
  apt-get update \
  && apt-get install -y \
    --no-install-recommends \
    libgl1-mesa-glx=20.3.5 \
    libglib2.0-0=2.66.8 \
    libopencv-dev=4.5.1+dfsg

This command gave the following error:

#0 0.775 E: Version '20.3.5' for 'libgl1-mesa-glx' was not found
#0 0.775 E: Version '2.66.8' for 'libglib2.0-0' was not found
#0 0.775 E: Version '4.5.1+dfsg' for 'libopencv-dev' was not found

I imagine that there is a good reason to pin some of these dependencies to older versions, but I'm not sure how to do that (I've tried using a few different versions for each of the three packages in this command, such as ). The only way I have been able to install these packages is by completely removing the wildcard version numbers =x.x.*.

Screenshots

No response

Additional context

No response

Contact Details

No response

briancaffey avatar Jun 21 '23 03:06 briancaffey

This is because the dockerhub image for python:3.9-slim defaulted to a new major version of Debian - 12 Bookworm. This new version does not have the same shape.

Changing the image source to Debian - 11 Bullseye. That is:

Change: https://github.com/invoke-ai/InvokeAI/blob/83e2b7578bcad08b384196f8ff050388bab0340e/docker/Dockerfile#L7

To:

FROM --platform=${TARGETPLATFORM} python:${PYTHON_VERSION}-slim-bullseye AS python-base

Rights the ship.

ghost avatar Jun 23 '23 07:06 ghost

Thanks @coricarson, that worked for me! I opened a PR to add this fix

briancaffey avatar Jun 24 '23 22:06 briancaffey

Closing this issue since there is a docker refactor planned. See this comment for more info: https://github.com/invoke-ai/InvokeAI/pull/3577#issuecomment-1607904927

briancaffey avatar Jun 28 '23 14:06 briancaffey