Databricks-ML-Pro Model Deployment Practice Question
An ML engineer needs to deploy a model to Databricks Model Serving that requires a custom Python package. The package is not available in the default Databricks Runtime and must be installed from a private PyPI repository. Which approach should be used to include this package in the model's environment?
⚠ Common exam trap
The trap here is assuming that serving endpoints can use cluster init scripts or interactive pip commands, which are not available in the managed serving environment.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Include the package in the model's conda.yaml or requirements.txt file when logging the model with MLflow.
Databricks Model Serving builds a container for the model based on the environment specified during MLflow model logging. By including the private PyPI package in the conda.yaml or requirements.txt with the appropriate index URL, the package is installed in the serving environment. This is the supported method for custom dependencies.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Install the package on the driver node of the serving cluster using a %pip magic command before deployment.
Why it's wrong here
Serving endpoints are not backed by a user-accessible cluster; you cannot run %pip commands on them. The serving infrastructure is managed by Databricks and does not allow interactive package installation. Dependencies must be included in the model artifact's environment files, which are used to build the serving container.
- ✗
Add the package to the cluster's init script and reference the cluster when creating the serving endpoint.
Why it's wrong here
Serving endpoints do not use cluster init scripts; they build a container image from the model's dependencies. Init scripts are for interactive or job clusters, not for model serving. Therefore, this approach will not install the package in the serving environment, leading to missing dependency errors at inference time.
- ✗
Upload the package as a Databricks notebook and import it at runtime within the model's predict function.
Why it's wrong here
Notebooks are not Python packages and cannot be imported as modules in the serving environment. The predict function runs in a container that does not have access to workspace notebooks. This method would fail because the package would not be available. Dependencies must be declared in the model's environment specification for proper installation.
- ✓
Include the package in the model's conda.yaml or requirements.txt file when logging the model with MLflow.
Why this is correct
When logging a model with MLflow, you can specify dependencies in a conda.yaml or requirements.txt file. Databricks Model Serving uses these files to build the serving container, installing the listed packages. By including the private PyPI package with its index URL in the requirements, the serving environment will have the necessary dependency, ensuring the model runs correctly.
About these practice questions
This Databricks-ML-Pro question is part of Courseiva's 300-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Databricks exam blueprint
This Databricks-ML-Pro practice question is part of Courseiva's free Databricks certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Databricks-ML-Pro exam.