Skip to content

Conversation

@moulin-louis
Copy link

Pull Request

Description

This PR implements automatic dependency installation for MLflow models during the model loading phase.
When the load function is called, the runtime will now automatically download and install the model's required dependencies from its requirements.txt file using pip install.

This is more of a POC to open discussion rather than an actual Pull Request but as all the necessary information is already stored by MLFlow in their MLFlow Model format, we can easily use them to simplify deployment of the model using a custom library.

Changes Made

  • Added automatic dependency installation in the MLflowRuntime.load() method
  • Implemented _install_dependencies() method that:
    • Downloads the requirements.txt file from the MLflow model artifacts
    • Installs dependencies using pip install
  • Added asyncio import to support asynchronous dependency installation
  • Dependencies are installed before the model is loaded to ensure all required packages are available
  • Modified Files:
    • runtimes/mlflow/mlserver_mlflow/runtime.py (+24 lines)

Additional Notes

  • Dependencies are installed synchronously during model load, which will increase initial load time for models with many dependencies
  • We can consider using uv instead plain old pip for faster install time but it will require uv to be avaible in the environment.

Signed-off-by: Louis Moulin <louis.moulin@outlook.fr>
Signed-off-by: Louis Moulin <louis.moulin@outlook.fr>
Signed-off-by: Louis Moulin <louis.moulin@outlook.fr>
Signed-off-by: Louis Moulin <louis.moulin@outlook.fr>
Signed-off-by: Louis Moulin <louis.moulin@outlook.fr>
@CLAassistant
Copy link

CLAassistant commented Jan 7, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants