Repository navigation
Fix Docker build: Python 3.12 base image and stale poetry.lock - #13
Open
sudipdhakal1 wants to merge 1 commit into
Open
sudipdhakal1 wants to merge 1 commit into
sudipdhakal1 wants to merge 1 commit into
Conversation
The image failed to build for two reasons: 1. The base image `tensorflow/tensorflow:2.16.1` ships Python 3.11, but `pyproject.toml` requires `python = "^3.12"`, so `poetry install` aborted with "Poetry was unable to find a compatible version." Switch to `python:3.12-slim-bookworm` (adding `libgomp1`, which the TensorFlow CPU wheel needs at runtime) and let Poetry install TensorFlow from the lockfile. 2. The committed `poetry.lock` is out of sync with `pyproject.toml`, so Poetry 2.x refuses with "pyproject.toml changed significantly since poetry.lock was last generated." Add a `poetry lock` step before `poetry install` to refresh it. With these changes `docker compose up --build` builds cleanly and the Prediction API serves requests on :8000. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
docker compose up --build(and the manualdocker build) currently fail out of the box. Two independent issues:1. Python version mismatch. The base image
tensorflow/tensorflow:2.16.1ships Python 3.11, butpyproject.tomlrequirespython = "^3.12".poetry installtherefore aborts:2. Stale lockfile. The committed
poetry.lockis out of sync withpyproject.toml, so Poetry 2.x refuses to install from it:Fix
python:3.12-slim-bookworm(satisfying the^3.12constraint) and let Poetry install TensorFlow from the lockfile. Addlibgomp1, which the TensorFlow CPU wheel needs at runtime.poetry lockstep beforepoetry installto refresh the lockfile.Verification
With these changes the image builds cleanly and the Prediction API serves on
:8000:Note for maintainers
The Python-version issue could alternatively be fixed by relaxing
pyproject.tomltopython = "^3.11"and keeping the officialtensorflow/tensorflow:2.16.1base image — a smaller diff. I went with thepython:3.12base image because it keeps the declared^3.12requirement intact and is the variant I built and verified end-to-end. Happy to switch to the^3.11approach if you prefer to stay on the TensorFlow base image.🤖 Generated with Claude Code