---
title: Environment version 4
description: Release notes for Databricks environment version 4.
canonical_url: https://docs.databricks.com/aws/en/release-notes/serverless/environment-version/four
---

# Environment version 4

This article outlines the system environment information for environment version 4.

To ensure compatibility for the application, serverless workloads use a versioned API, known as the environment version, which remains compatible with newer server versions.

You can select a base environment that includes this environment version using the **Environment** side panel in your serverless notebooks. See [ Select a base environment](https://docs.databricks.com/aws/en/compute/serverless/dependencies.md#base-environment).

## New features and improvements

The following new features and improvements are available in environment version 4.

### Spark ML support on serverless compute

Serverless compute now supports Spark ML in PySpark (pyspark.ml) and MLflow for Spark (mlflow\.spark) in environment version 4. For hyperparameter tuning on serverless compute, Databricks recommends using Optuna and Joblib Spark.

The following limitations apply when running SparkML on serverless compute:

* The maximum model size is 100MB.
* The maximum total size of in-memory models per session is 1GB.
* Tree model training stops early if the model size is about to exceed 100MB.
* The following SparkML models are not supported:
  * DistributedLDAModel
  * FPGrowthModel

### Scala and Java UDFs in Unity Catalog

Serverless environment version 4 supports Scala and Java user-defined functions (UDFs) in Unity Catalog. You can create, register, and share custom Scala and Java functions across compute environments with Unity Catalog governance. For Scala UDFs in Unity Catalog, only Scala version 2.13.16 is supported. Scala and Java UDFs in Unity Catalog require JDK 17.

For more information, see [Scala and Java user-defined functions (UDFs) in Unity Catalog](https://docs.databricks.com/aws/en/udf/scala-java-uc.md).

### Scalar Python UDFs now support service credentials

Scalar Python UDFs can use Unity Catalog service credentials to securely access external cloud services. For more information, see [Service credentials in Python UDFs](https://docs.databricks.com/aws/en/udf/python.md#udf-service-credentials).

### PySpark and Spark Connect now support the DataFrames `df.mergeInto` API

PySpark and Spark Connect now support the `df.mergeInto` API, which was previously only available for Scala.

### API updates

Environment version 4 includes the following API updates:

* [SPARK-50915](https://issues.apache.org/jira/browse/SPARK-50915) Add `getCondition` and deprecate `getErrorClass` in `PySparkException`
* [SPARK-50719](https://issues.apache.org/jira/browse/SPARK-50719) Support `interruptOperation` for PySpark
* [SPARK-50718](https://issues.apache.org/jira/browse/SPARK-50718) Support `addArtifact(s)` for PySpark
* [SPARK-49530](https://issues.apache.org/jira/browse/SPARK-49530) Support pie subplots in PySpark plotting
* [SPARK-50357](https://issues.apache.org/jira/browse/SPARK-50357) Support `Interrupt(Tag|All)` APIs for PySpark
* [SPARK-51178](https://issues.apache.org/jira/browse/SPARK-51178) Raise proper PySpark error instead of `SparkConnectGrpcException`
* [SPARK-51227](https://issues.apache.org/jira/browse/SPARK-51227) Fix PySpark Connect `_minimum_grpc_version` to 1.67.0
* [SPARK-50778](https://issues.apache.org/jira/browse/SPARK-50778) Add `metadataColumn` to PySpark DataFrame
* [SPARK-50311](https://issues.apache.org/jira/browse/SPARK-50311) Support `(add|remove|get|clear)Tag(s)` APIs for PySpark
* [SPARK-50310](https://issues.apache.org/jira/browse/SPARK-50310) Add a flag to disable `DataFrameQueryContext` for PySpark
* [SPARK-50238](https://issues.apache.org/jira/browse/SPARK-50238) Add Variant Support in PySpark UDFs/UDTFs/UDAFs and Python UC UDFs
* [SPARK-50183](https://issues.apache.org/jira/browse/SPARK-50183) Unify the internal functions for Pandas API and PySpark Plotting
* [SPARK-50170](https://issues.apache.org/jira/browse/SPARK-50170) Move `_invoke_internal_function_over_columns` to `pyspark.sql.utils`
* [SPARK-50167](https://issues.apache.org/jira/browse/SPARK-50167) Improve PySpark plotting error messages and imports
* [SPARK-48961](https://issues.apache.org/jira/browse/SPARK-48961) Make the parameter naming of `PySparkException` consistent with JVM
* [SPARK-49567](https://issues.apache.org/jira/browse/SPARK-49567) Use classic instead of vanilla from PySpark code base
* [SPARK-48755](https://issues.apache.org/jira/browse/SPARK-48755) `transformWithState` PySpark base implementation and `ValueState` support
* [SPARK-48714](https://issues.apache.org/jira/browse/SPARK-48714) Implement `DataFrame.mergeInto` in PySpark
* [SPARK-47365](https://issues.apache.org/jira/browse/SPARK-47365) Add `toArrow()` DataFrame method to PySpark
* [SPARK-48075](https://issues.apache.org/jira/browse/SPARK-48075) Type checking for PySpark avro functions
* [SPARK-46984](https://issues.apache.org/jira/browse/SPARK-46984) Remove `pyspark.copy_func`
* [SPARK-46213](https://issues.apache.org/jira/browse/SPARK-46213) Introduce `PySparkImportError` for error framework
* [SPARK-46226](https://issues.apache.org/jira/browse/SPARK-46226) Migrate all remaining `RuntimeError` into PySpark error framework
* [SPARK-45450](https://issues.apache.org/jira/browse/SPARK-45450) Fix imports according to PEP8: `pyspark.pandas` and `pyspark` (core)

## System environment

* **Operating System**: Ubuntu 24.04.2 LTS
* **Python**: 3.12.3
* **Databricks Connect**: 17 (Databricks Connect is continuously updated in the latest environment version. Run `pip list` to confirm the exact version in your current environment.)
* **Scala**: 2.13.16
* **JDK**: 17

### <a id="installed-libraries" /> Installed Python libraries

> [!NOTE]
>
> The requirements files record the package versions for this release. Reproducing these versions can install outdated certificate authority bundles, including `certifi`. Before making remote HTTPS connections, apply the bundle updates listed in the [eMudhra security advisory](https://emudhra.we-have-a-problem.com/). Keep TLS certificate verification enabled and test package compatibility after the updates.

To reproduce environment version 4 in your local Python virtual environment, download the [requirements-env-4.txt](https://docs.databricks.com/aws/en/documents/requirements-env-4.txt) file and run `pip install -r requirements-env-4.txt`. This command installs all of the libraries from environment version 4.

| Library                     | Version        | Library                    | Version     | Library                            | Version    |
| --------------------------- | -------------- | -------------------------- | ----------- | ---------------------------------- | ---------- |
| annotated-types             | 0.7.0          | anyio                      | 4.6.2       | argon2-cffi                        | 21.3.0     |
| argon2-cffi-bindings        | 21.2.0         | arrow                      | 1.3.0       | asttokens                          | 2.0.5      |
| astunparse                  | 1.6.3          | async-lru                  | 2.0.4       | attrs                              | 24.3.0     |
| azure-common                | 1.1.28         | azure-core                 | 1.34.0      | azure-identity                     | 1.20.0     |
| azure-mgmt-core             | 1.5.0          | azure-mgmt-web             | 8.0.0       | azure-storage-blob                 | 12.23.0    |
| azure-storage-file-datalake | 12.17.0        | babel                      | 2.16.0      | beautifulsoup4                     | 4.12.3     |
| black                       | 24.10.0        | bleach                     | 6.2.0       | boto3                              | 1.36.2     |
| botocore                    | 1.36.3         | cachetools                 | 5.5.1       | certifi                            | 2026.10.19 |
| cffi                        | 1.17.1         | chardet                    | 4.0.0       | charset-normalizer                 | 3.3.2      |
| click                       | 8.1.7          | cloudpickle                | 3.0.0       | comm                               | 0.2.1      |
| contourpy                   | 1.3.1          | cryptography               | 43.0.3      | cycler                             | 0.11.0     |
| Cython                      | 3.0.12         | databricks-connect         | 17.3.15     | databricks-sdk                     | 0.49.0     |
| debugpy                     | 1.8.11         | decorator                  | 5.1.1       | defusedxml                         | 0.7.1      |
| Deprecated                  | 1.2.13         | docstring-to-markdown      | 0.11        | executing                          | 0.8.3      |
| facets-overview             | 1.1.1          | fastapi                    | 0.115.12    | fastjsonschema                     | 2.21.1     |
| fonttools                   | 4.55.3         | fqdn                       | 1.5.1       | fsspec                             | 2023.5.0   |
| gitdb                       | 4.0.11         | GitPython                  | 3.1.43      | google-api-core                    | 2.20.0     |
| google-auth                 | 2.40.0         | google-cloud-core          | 2.4.3       | google-cloud-storage               | 3.1.0      |
| google-crc32c               | 1.7.1          | google-resumable-media     | 2.7.2       | googleapis-common-protos           | 1.65.0     |
| grpcio                      | 1.67.0         | grpcio-status              | 1.67.0      | h11                                | 0.14.0     |
| httpcore                    | 1.0.2          | httpx                      | 0.27.0      | idna                               | 3.7        |
| importlib-metadata          | 6.6.0          | iniconfig                  | 1.1.1       | ipyflow-core                       | 0.0.209    |
| ipykernel                   | 6.29.5         | ipython                    | 8.30.0      | ipython-genutils                   | 0.2.0      |
| ipywidgets                  | 7.8.1          | isodate                    | 0.6.1       | isoduration                        | 20.11.0    |
| jedi                        | 0.19.2         | Jinja2                     | 3.1.5       | jmespath                           | 1.0.1      |
| joblib                      | 1.4.2          | json5                      | 0.9.25      | jsonpointer                        | 3.0.0      |
| jsonschema                  | 4.23.0         | jsonschema-specifications  | 2023.7.1    | jupyter-events                     | 0.10.0     |
| jupyter-lsp                 | 2.2.0          | jupyter\_client            | 8.6.3       | jupyter\_core                      | 5.7.2      |
| jupyter\_server             | 2.14.1         | jupyter\_server\_terminals | 0.4.4       | jupyterlab                         | 4.3.4      |
| jupyterlab-pygments         | 0.1.2          | jupyterlab-widgets         | 1.0.0       | jupyterlab\_server                 | 2.27.3     |
| kiwisolver                  | 1.4.8          | markdown-it-py             | 2.2.0       | MarkupSafe                         | 3.0.2      |
| matplotlib                  | 3.10.0         | matplotlib-inline          | 0.1.7       | mccabe                             | 0.7.0      |
| mdurl                       | 0.1.0          | mistune                    | 2.0.4       | mlflow-skinny                      | 2.22.0     |
| mmh3                        | 5.1.0          | msal                       | 1.32.3      | msal-extensions                    | 1.3.1      |
| mypy-extensions             | 1.0.0          | nbclient                   | 0.8.0       | nbconvert                          | 7.16.4     |
| nbformat                    | 5.10.4         | nest-asyncio               | 1.6.0       | nodeenv                            | 1.9.1      |
| notebook                    | 7.3.2          | notebook\_shim             | 0.2.3       | numpy                              | 2.1.3      |
| opentelemetry-api           | 1.32.1         | opentelemetry-sdk          | 1.32.1      | opentelemetry-semantic-conventions | 0.53b1     |
| overrides                   | 7.4.0          | packaging                  | 24.1        | pandas                             | 2.2.3      |
| pandocfilters               | 1.5.0          | parso                      | 0.8.4       | pathspec                           | 0.10.3     |
| patsy                       | 1.0.1          | pexpect                    | 4.8.0       | pillow                             | 11.1.0     |
| pip                         | 25.0.1         | platformdirs               | 3.10.0      | plotly                             | 5.24.1     |
| pluggy                      | 1.5.0          | prometheus\_client         | 0.21.0      | prompt-toolkit                     | 3.0.43     |
| proto-plus                  | 1.26.1         | protobuf                   | 5.29.4      | psutil                             | 5.9.0      |
| psycopg2                    | 2.9.3          | ptyprocess                 | 0.7.0       | pure-eval                          | 0.2.2      |
| py4j                        | 0.10.9.9       | pyarrow                    | 19.0.1      | pyasn1                             | 0.4.8      |
| pyasn1-modules              | 0.2.8          | pyccolo                    | 0.0.71      | pycparser                          | 2.21       |
| pydantic                    | 2.10.6         | pydantic\_core             | 2.27.2      | pyflakes                           | 3.2.0      |
| Pygments                    | 2.15.1         | pyiceberg                  | 0.9.0       | PyJWT                              | 2.10.1     |
| pyodbc                      | 5.2.0          | pyparsing                  | 3.2.0       | pyright                            | 1.1.394    |
| pytest                      | 8.3.5          | python-dateutil            | 2.9.0.post0 | python-json-logger                 | 3.2.1      |
| python-lsp-jsonrpc          | 1.1.2          | python-lsp-server          | 1.12.0      | pytoolconfig                       | 1.2.6      |
| pytz                        | 2026.5         | PyYAML                     | 6.0.2       | pyzmq                              | 26.2.0     |
| referencing                 | 0.30.2         | requests                   | 2.32.3      | rfc3339-validator                  | 0.1.4      |
| rfc3986-validator           | 0.1.1          | rich                       | 13.9.4      | rope                               | 1.12.0     |
| rpds-py                     | 0.22.3         | rsa                        | 4.9.1       | s3transfer                         | 0.11.3     |
| scikit-learn                | 1.6.1          | scipy                      | 1.15.1      | seaborn                            | 0.13.2     |
| Send2Trash                  | 1.8.2          | smmap                      | 5.0.0       | sniffio                            | 1.3.0      |
| sortedcontainers            | 2.4.0          | soupsieve                  | 2.5         | sqlparse                           | 0.5.3      |
| stack-data                  | 0.2.0          | starlette                  | 0.46.2      | statsmodels                        | 0.14.4     |
| strictyaml                  | 1.7.3          | tenacity                   | 9.0.0       | terminado                          | 0.17.1     |
| threadpoolctl               | 3.5.0          | tinycss2                   | 1.4.0       | tokenize\_rt                       | 6.1.0      |
| tomli                       | 2.0.1          | tornado                    | 6.4.2       | traitlets                          | 5.14.3     |
| types-python-dateutil       | 2.9.0.20241206 | typing\_extensions         | 4.12.2      | tzdata                             | 2026.5     |
| ujson                       | 5.10.0         | uri-template               | 1.3.0       | urllib3                            | 2.3.0      |
| uvicorn                     | 0.34.2         | wcwidth                    | 0.2.5       | webcolors                          | 24.11.1    |
| webencodings                | 0.5.1          | websocket-client           | 1.8.0       | whatthepatch                       | 1.0.2      |
| widgetsnbextension          | 3.6.6          | wrapt                      | 1.17.0      | yapf                               | 0.40.2     |
| zipp                        | 3.21.0         | zstandard                  | 0.23.0      |                                    |            |

### Installed Java and Scala libraries (Scala 2.13)

| Group ID                       | Artifact ID                          | Version                                   |
| ------------------------------ | ------------------------------------ | ----------------------------------------- |
| com.databricks                 | databricks-connect\_2.13             | 17.3.1                                    |
| com.databricks                 | databricks-dbutils-scala\_2.13       | 0.1.4                                     |
| com.databricks                 | databricks-sdk-java                  | 0.52.0                                    |
| com.fasterxml.jackson.core     | jackson-annotations                  | 2.15.2                                    |
| com.fasterxml.jackson.core     | jackson-core                         | 2.15.2                                    |
| com.fasterxml.jackson.core     | jackson-databind                     | 2.15.2                                    |
| com.fasterxml.jackson.datatype | jackson-datatype-jsr310              | 2.15.2                                    |
| com.google.auth                | google-auth-library-credentials      | 1.20.0                                    |
| com.google.auth                | google-auth-library-oauth2-http      | 1.20.0                                    |
| com.google.auto.value          | auto-value-annotations               | 1.10.4                                    |
| com.google.code.gson           | gson                                 | 2.10.1                                    |
| com.google.errorprone          | error\_prone\_annotations            | 2.18.0                                    |
| com.google.guava               | failureaccess                        | 1.0.1                                     |
| com.google.guava               | guava                                | 32.0.1-jre                                |
| com.google.guava               | listenablefuture                     | 9999.0-empty-to-avoid-conflict-with-guava |
| com.google.http-client         | google-http-client                   | 1.43.3                                    |
| com.google.http-client         | google-http-client-gson              | 1.43.3                                    |
| com.google.j2objc              | j2objc-annotations                   | 2.8                                       |
| com.lihaoyi                    | ammonite-compiler-interface\_2.13.16 | 3.0.8                                     |
| com.lihaoyi                    | ammonite-compiler\_2.13.16           | 3.0.8                                     |
| com.lihaoyi                    | ammonite-interp-api\_2.13.16         | 3.0.8                                     |
| com.lihaoyi                    | ammonite-interp\_2.13.16             | 3.0.8                                     |
| com.lihaoyi                    | ammonite-repl-api\_2.13.16           | 3.0.8                                     |
| com.lihaoyi                    | ammonite-repl\_2.13.16               | 3.0.8                                     |
| com.lihaoyi                    | ammonite-runtime\_2.13.16            | 3.0.8                                     |
| com.lihaoyi                    | ammonite-terminal\_2.13              | 3.0.8                                     |
| com.lihaoyi                    | ammonite-util\_2.13                  | 3.0.8                                     |
| com.lihaoyi                    | fansi\_2.13                          | 0.5.1                                     |
| com.lihaoyi                    | mainargs\_2.13                       | 0.7.6                                     |
| com.lihaoyi                    | os-lib\_2.13                         | 0.11.3                                    |
| com.lihaoyi                    | pprint\_2.13                         | 0.9.0                                     |
| com.lihaoyi                    | scalaparse\_2.13                     | 3.1.1                                     |
| com.lihaoyi                    | scalatags\_2.13                      | 0.13.1                                    |
| com.thesamet.scalapb           | lenses\_2.13                         | 0.11.15                                   |
| com.thesamet.scalapb           | scalapb-runtime\_2.13                | 0.11.15                                   |
| com.thoughtworks.paranamer     | paranamer                            | 2.8                                       |
| commons-codec                  | commons-codec                        | 1.11                                      |
| commons-io                     | commons-io                           | 2.14.0                                    |
| commons-logging                | commons-logging                      | 1.3.2                                     |
| io.github.java-diff-utils      | java-diff-utils                      | 4.15                                      |
| io.grpc                        | grpc-context                         | 1.27.2                                    |
| io.opencensus                  | opencensus-api                       | 0.31.1                                    |
| io.opencensus                  | opencensus-contrib-http-util         | 0.31.1                                    |
| org.apache.commons             | commons-configuration2               | 2.11.0                                    |
| org.apache.commons             | commons-lang3                        | 3.14.0                                    |
| org.apache.commons             | commons-text                         | 1.12.0                                    |
| org.apache.httpcomponents      | httpclient                           | 4.5.14                                    |
| org.apache.httpcomponents      | httpcore                             | 4.4.16                                    |
| org.apache.logging.log4j       | log4j-api                            | 2.20.0                                    |
| org.apache.logging.log4j       | log4j-core                           | 2.20.0                                    |
| org.apache.logging.log4j       | log4j-slf4j-impl                     | 2.24.3                                    |
| org.checkerframework           | checker-qual                         | 3.33.0                                    |
| org.jline                      | jline                                | 3.27.1                                    |
| org.jline                      | jline-reader                         | 3.14.1                                    |
| org.jline                      | jline-terminal                       | 3.14.1                                    |
| org.json                       | json                                 | 20240303                                  |
| org.json4s                     | json4s-ast\_2.13                     | 4.0.7                                     |
| org.json4s                     | json4s-core\_2.13                    | 4.0.7                                     |
| org.json4s                     | json4s-jackson-core\_2.13            | 4.0.7                                     |
| org.json4s                     | json4s-jackson\_2.13                 | 4.0.7                                     |
| org.json4s                     | json4s-scalap\_2.13                  | 4.0.7                                     |
| org.scala-lang                 | scala-compiler\_2.13                 | 2.13.16                                   |
| org.scala-lang                 | scala-library\_2.13                  | 2.13.16                                   |
| org.scala-lang                 | scala-reflect\_2.13                  | 2.13.16                                   |
| org.scala-lang                 | scalap\_2.13                         | 2.13.13                                   |
| org.scala-lang.modules         | scala-collection-compat\_2.13        | 2.13.0                                    |
| org.scala-lang.modules         | scala-java8-compat\_2.13             | 1.0.2                                     |
| org.scalameta                  | io\_2.13                             | 4.13.10                                   |
| org.scalameta                  | mtags-interfaces                     | 1.6.3                                     |
| org.scalameta                  | mtags-shared\_2.13.16                | 1.6.3                                     |
| org.scalameta                  | mtags\_2.13.16                       | 1.6.3                                     |
| org.scalameta                  | parsers\_2.13                        | 4.13.10                                   |
| org.scalameta                  | scalameta\_2.13                      | 4.13.10                                   |
| org.scalameta                  | semanticdb-scalac-core\_2.13.16      | 4.13.10                                   |
| org.scalameta                  | trees\_2.13                          | 4.13.10                                   |
| org.slf4j                      | slf4j-api                            | 2.0.10                                    |
| org.slf4j                      | slf4j-nop                            | 1.7.36                                    |
| sh.almond                      | channels\_2.13                       | 0.14.5                                    |
| sh.almond                      | coursier-logger\_2.13                | 0.14.5                                    |
| sh.almond                      | interpreter-api\_2.13                | 0.14.5                                    |
| sh.almond                      | interpreter\_2.13                    | 0.14.5                                    |
| sh.almond                      | jupyter-api\_2.13                    | 0.14.5                                    |
| sh.almond                      | kernel\_2.13                         | 0.14.5                                    |
| sh.almond                      | logger-scala2-macros\_2.13           | 0.14.5                                    |
| sh.almond                      | logger\_2.13                         | 0.14.5                                    |
| sh.almond                      | protocol\_2.13                       | 0.14.5                                    |
| sh.almond                      | scala-interpreter\_2.13.16           | 0.14.5                                    |
| sh.almond                      | scala-kernel-api\_2.13.16            | 0.14.5                                    |
| sh.almond                      | scala-kernel\_2.13.16                | 0.14.5                                    |
| sh.almond                      | shared-directives\_2.13              | 0.14.5                                    |
| sh.almond                      | toree-hooks\_2.13                    | 0.14.5                                    |
