ModuleNotFoundError: No module named 'distutils'

I have forked taiga-back and using its stable branch.

repo : GitHub - zarir-engineer/taiga-back

In the dockerfile the first line is

FROM python:3.11-slim

in contrast the control is going thru python 3.12 as the error shows. Please suggest a work around for this. Or what am i missing here. ?

Error:

File “/tmp/pip-build-env-wlebbpoz/overlay/lib/python3.12/site-packages/setuptools/init.py”, line 10, in import distutils.core ModuleNotFoundError: No module named ‘distutils’

There is a discrepancy between the Docker image and the host system’s Python version.

if the dockerfile is using python 3.11, then the control should go thru python3.11/site-packages/…

As an alternative, please advise on how to clear cache of last build so that fresh one does not base on the previous one to save time. This is to ensure that changes in dockerfile to python3.11 reflect in the deployment.

I also observe that this line is not present in dockerfile. How does the build happen ?

docker build --no-cache -f docker/Dockerfile -t taigaio/taiga-back:latest .