CertSafari
    Databricks Certified Data Engineer Professional· Lessons

    Domain 1 · Lesson 10/46

    Serverless Environments and Dependency Management

    Choose appropriate compute and configuration for environments and dependencies — including serverless compute (serverless environments, dependency management, performance mode), high-memory notebook tasks, and auto-optimization settings (e.g., disallowing retries).

    8 min read
    1.92% of exam
    2 sources
    Published 2 Oct 2026
    Docs as of 30 Sep 2026

    What you will be able to do

    • Explain how serverless environment versions replace Databricks Runtime versions
    • Add PyPI, wheel and project dependencies to a serverless notebook or job task
    • Avoid the PySpark, CPU-architecture and private-repository pitfalls that break serverless dependency installs

    Key concept

    Serverless environment (environment version) — On serverless compute you don't choose a Databricks Runtime or install libraries on a cluster. You choose a base environment version, which gives your code a stable client API, and you declare dependencies on top of it. Databricks resolves and caches those dependencies, and it upgrades the servers underneath without you having to do anything.

    1.Environment versions instead of runtime versions

    On classic compute, you pick a Databricks Runtime version and handle upgrades yourself. Serverless works differently: you write code against an environment version, and Databricks upgrades the underlying servers on its own schedule. The environment version gives you a stable client API, so performance improvements, security fixes and bug fixes reach your workload without code changes. Databricks supports each environment version for three years after its release, which gives you a predictable timeline for planning upgrades.

    In a notebook, you choose the version with the Base environment selector in the Environment side pane. Standard is the default and includes Databricks-provided libraries. ML pre-installs the Python and system packages from Databricks Runtime for Machine Learning, which makes it the option for moving classic ML workloads to serverless. AI appears only after you select a GPU accelerator. Under More you'll find earlier versions and Custom, which loads a YAML specification. Workspace environments lists base environments that an administrator has set up. Databricks recommends the latest version.

    Base environment options in the serverless Environment side pane
    OptionWhat it gives you
    StandardDefault serverless base environment with Databricks-provided libraries
    MLPython and system packages from Databricks Runtime for Machine Learning pre-installed
    AIAI-optimized environment with ML libraries; appears only when a GPU accelerator is selected
    More → CustomEnvironment specified by a YAML file
    Workspace environmentsCompatible base environments configured by a workspace administrator

    Checkpoint 1 of 4· Check yourself

    A team is moving a classic Databricks Runtime ML notebook to serverless. They want the same pre-installed ML packages without listing each one. Which base environment should they choose?

    Sources12

    2.Adding dependencies without init scripts

    Serverless has no init scripts and no compute policies, so you declare dependencies in the Environment side pane. In the Dependencies section, enter any line that would be valid in a requirements.txt file and click Apply. Databricks installs the dependencies and restarts the Python process. A wheel or a Python project (a directory containing pyproject.toml or setup.py) can come from workspace files, using an absolute path that starts with /Workspace/, or from a Unity Catalog volume, using a path in the form /Volumes/<catalog>/<schema>/<volume>/<path>.whl. For example, after you add a project folder at /Workspace/helper_utils that contains a helpers package, you can import it directly:

    Using a workspace-file Python project after adding it as a serverless dependencypython
    from helpers import greet
    print(greet('world'))

    Databricks caches the notebook's virtual environment, so dependencies don't reinstall each time you reopen the notebook or resume after inactivity. Job tasks with the same dependency set share this cache within a run. To keep environments reproducible, pin exact versions. An unpinned package can resolve to a different version depending on the environment version, and installing that new version adds latency. Once an environment works, you can export it from the pane as a YAML specification and reuse it through Custom.

    Pinned versions in a requirements.txt for serverlesstext
    numpy==2.2.2
    pandas==2.2.3

    Checkpoint 2 of 4· Exam question

    A data engineering team runs a nightly Lakeflow Job on serverless compute that ingests and transforms roughly 2 TB of data. The job has no interactive users, can tolerate a startup delay of several minutes, and the team wants to minimize DBU spend without rewriting the job's logic. Which change should they make to the job's compute configuration?

    Sources21

    3.CPU architecture and private repositories

    Two serverless properties catch teams out. First, serverless doesn't guarantee a CPU architecture. A run can land on aarch64 or x86_64, and that can change between runs. A wheel with native C extensions only works on the architecture it was built for, so installing it on the other one fails. Use pure-Python wheels tagged py3-none-any where you can. Otherwise, provide both aarch64 and x86_64 wheels and restrict each one to its architecture with a platform_machine environment marker.

    Second, Databricks resolves and installs dependencies before any of your code runs. Nothing in a notebook cell can change how packages are fetched. Serverless also doesn't support compute-scoped environment variables, so setting a proxy at runtime has no effect. To install from a private or authenticated repository, put index-url or extra-index-url in the dependency specification, or ask a workspace admin to make that repository the default package source.

    Checkpoint 3 of 4· Check yourself

    A data engineer adds os.environ['HTTPS_PROXY'] = ... as the first cell of a serverless notebook so a package can be fetched from a private index. Installation still fails. What should they do?

    Sources2

    4.Environments for serverless job tasks

    Job tasks use the same environment model, but you configure it on the task. When you create or edit a task, open Jobs Environment and either edit an existing environment or add a new one. In the Configure environment dialog, choose a base environment: a Databricks option such as Standard or ML, a workspace environment, or a Custom YAML file. Under Dependencies, add any extra libraries using requirements.txt syntax, an absolute workspace-file path or a Unity Catalog volume path. If the workspace base environment preview isn't enabled, the dialog shows an Environment version drop-down instead. In that case you can also reference a requirements file, for example -r /Workspace/path/to/requirements.txt.

    Checkpoint 4 of 4· Fill the gap

    After adding /Workspace/helper_utils as a dependency, which name completes the import?

    from helpers import  ? 
    print(greet('world'))

    Sources2

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.You can install a specific PySpark version on serverless to match a library's requirements.Why is that wrong?

      Installing PySpark, or a library that depends on it, stops the serverless session with an error. You must remove the library and reset the environment.

      Covered in Adding dependencies without init scripts

    2. 2.Setting proxy environment variables in a notebook cell lets serverless install packages from a private repository.Why is that wrong?

      Dependencies are resolved before your code runs, and runtime proxy settings have no effect. Use index-url or extra-index-url, or an admin-configured default repository.

      Covered in CPU architecture and private repositories

    Sources

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “You write code against an environment version, and Databricks independently upgrades the underlying server.”
      ↩︎ Environment versions instead of runtime versions
      “Databricks supports each environment version for three years from its release date”
      ↩︎ Environment versions instead of runtime versions
      “pin your Python packages to specific versions to ensure reproducible environments.”
      ↩︎ Adding dependencies without init scripts
      “Serverless compute uses environment versions instead of traditional Databricks Runtime versions.”
      ↩︎ Key concept
    2. 2.
      “A base environment determines the pre-installed libraries and environment version available for your serverless notebook.”
      ↩︎ Environment versions instead of runtime versions
      “You can specify a dependency in any format that is valid in a requirements.txt file.”
      ↩︎ Adding dependencies without init scripts
      “Job tasks that share the same dependency set also benefit from this cache within a run.”
      ↩︎ Adding dependencies without init scripts
      “Serverless compute does not guarantee a specific CPU architecture.”
      ↩︎ CPU architecture and private repositories
      “proxy settings applied at runtime have no effect on dependency installation.”
      ↩︎ CPU architecture and private repositories
      “For job tasks, configure the environment when you create or edit a task.”
      ↩︎ Environments for serverless job tasks
      “Under Dependencies, add any additional libraries.”
      ↩︎ Environments for serverless job tasks
      “Do not install PySpark or any library that installs PySpark as a dependency on your serverless notebooks.”
      ↩︎ Exam trap 1
      “Databricks resolves and installs dependencies before your notebook or task code runs.”
      ↩︎ Exam trap 2
      “Use this environment to migrate classic Databricks Runtime for Machine Learning workloads to serverless compute.”
      ↩︎ Checkpoint
      “Because serverless does not support compute policies or init scripts, you must install custom dependencies using the Environment side pane.”
      ↩︎ Prediction
      “To install from a private or authenticated package repository, specify index-url or extra-index-url in the dependency specification.”
      ↩︎ Checkpoint
      “In the Dependencies section, click Add Dependency then enter the path of your util file.”
      ↩︎ Checkpoint

    Continue to page 2 of 2

    Serverless Performance Mode, High Memory and Auto-Optimization

    Spotted a mistake, or was something unclear? Tell us.