Pkg_resources is not defined in python docker

Hi all,

for some time now, I am maintaining a service developed as a python app by my colleagues. I have a docker image that’s been working perfectly until recently when they introduced the dependency on XGBoost. Since then, we are getting an exception in the python script with an error: “pkg_resources is not defined”. Here is the relevant dockerfile content:

FROM python:3.10.5 as python-base

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base

COPY --from=python-base /usr/local /usr/local

ENV LD_LIBRARY_PATH /usr/local/lib

WORKDIR /app
EXPOSE 80
EXPOSE 443

And here is my requirements file:

pandas==1.4.3
torch==1.12.0
pytorch_tabnet==3.1.1
pickle-mixin==1.0.2
pygrnn==0.1.2
xgboost==1.6.1

During the attempts to fix it I also got error “ImportError: libexpat.so.1: cannot open shared object file: No such file or directory”

The line where it crashes:

nw = pickle.load(open( model_file, ‘rb’))

I’ve tried installing different additional packages, replicating their local development environments, adding C++ redistributable packages (saw it in XGBoost documentation) and no luck.

Any idea what is my docker image missing?