Open sparse-coder opened 5 months ago
We're looking to do something similar, you can use conda
to update the runtime env with conda install -y 'python=3.11'
but unfortunately unseats the promptflow-runtime whl and since that wheel is unpublished, you can't get it back from upstream. You have to manually copy it between Python versions:
FROM mcr.microsoft.com/azureml/promptflow/promptflow-runtime:latest
# Update to Python 3.11
RUN conda install -y 'python=3.11' -p /azureml-envs/prompt-flow/runtime && \
pip install --no-cache-dir -r extra_requirements.txt && \
# Copy Python 3.9 promptflow-runtime whl to 3.11
RUN cp -a azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow/runtime azureml-envs/prompt-flow/runtime/lib/python3.11/site-packages/promptflow/ && \
sed -i -e 's|bin/python3.9|bin/python3.11|' /azureml-envs/prompt-flow/runtime/bin/prt && \
grep ^Requires-Dist azureml-envs/prompt-flow/runtime/lib/python3.9/site-packages/promptflow_runtime-*.dist-info/METADATA | cut -d' ' -f2- | cut -d';' -f1 > promptflow-runtime-requirements.txt && \
pip install --no-cache-dir -r promptflow-runtime-requirements.txt
It's ugly and probably prone to breakage so YMMV, but it works with the current image. If you want to investigate further, this is what helped me:
# pseudo-generate the original dockerfile instructions
docker history --no-trunc --format json mcr.microsoft.com/azureml/promptflow/promptflow-runtime | jq -r '.CreatedBy' | tac
# start the runtime img to inspect its dependencies
docker run -it --rm --entrypoint /bin/bash mcr.microsoft.com/azureml/promptflow/promptflow-runtime:latest /bin/bash
pip show -f promptflow-runtime
@stewartadam Thank you! I did the same thing by updating the conda env, but this idea of copying the promptflow-runtime wheel didn't occur to me. Good idea👍 BTW!
For now we have decided to not go through this route!
Thank you!
Hi, is this issue expected to be fixed in the future?
@ebotiab agreed, this should not be so hard to change base image Python version
We are using our own environment definition to build the promptflow runtime image, and use it as the base for provisioning the custom runtime on AML compute instance for doing batch and evaluation runs.
So far we are good.
What we need is a way to use a different python version e.g. Python 3.11 on my custom runtime. Is there a way I can do this? So far what I have observed is all the base images supplied by mcr use python 3.9.
My docker file looks like this
FROM mcr.microsoft.com/azureml/promptflow/promptflow-runtime-stable:20240515.v1 COPY ./* ./ RUN pip install -r requirements.txt
Is there a way I can define something in my docker file to upgrade the python version?