cancel
Showing results for 
Search instead for 
Did you mean: 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results for 
Search instead for 
Did you mean: 

Spark connect client and server versions should be same for executing UDFs

chinmay0924
New Contributor III

I am trying to execute pandas UDF in databricks. It gives me the following error on serverless compute,

File /local_disk0/.ephemeral_nfs/envs/pythonEnv-b11ff17c-9b25-4ccb-927d-06a7d1ca7221/lib/python3.11/site-packages/pyspark/sql/connect/client/core.py:2340, in SparkConnectClient._handle_rpc_error(self, rpc_error) 2325 raise Exception( 2326 "Python versions in the Spark Connect client and server are different. " 2327 "To execute user-defined functions, client and server should have the " (...) 2336 "https://docs.databricks.com/en/release-notes/serverless.html" target="_blank" rel="noopener noreferrer">https://docs.databricks.com/en/release-notes/serverless.html</a>.</span><span class="ansi-yellow-fg">"

As far as I am aware, I cannot change the python version of the client in serverless. Are there any ways to fix this issue from my side?

1 ACCEPTED SOLUTION

Accepted Solutions

BigRoux
Databricks Employee
Databricks Employee

Serverless is management free which means you cannot choose the image.  Hope this helps. Lou.

View solution in original post

5 REPLIES 5

BigRoux
Databricks Employee
Databricks Employee

Correct, you cannot alter any pre-installed libraries on Serverless.  Have you considered changing your client side Python to align with the version running on the Serverless cluster?

 

chinmay0924
New Contributor III

If I am using the databricks notebook with serverless attached, how do I change the client side python? I have control over client side python if I use databricks connect from my local setup, but is there a way to change the client side python version from databricks itself?

BigRoux
Databricks Employee
Databricks Employee
When using a Databricks notebook attached to serverless compute, the Python version on the client side is determined by the underlying Serverless client image. This version is fixed and coupled with the Databricks Runtime (DBR) version or the Client Image version in the serverless environment. For example, Serverless Client Image v1 is tied to a specific Python version (e.g., Python 3.10.12 for DBR 14.3), and switching the DBR version changes the Python environment in use.
 
Currently, there is no direct way in Databricks to modify the default client-side Python version in serverless notebooks without changing the underlying DBR version or using custom measures like modifying deployment images.
 
For now, if you want to control the Python version for development purposes, using Databricks Connect locally remains your best option, as it allows full flexibility in configuring the desired Python environment on your local machine.
 
Hope this helps, Big Roux.

chinmay0924
New Contributor III

Thanks a lot for the reply! Final question: Is it possible for the end user to select a serverless client image version or is that not something that I can choose? If so, how? I couldn't find any documentation regarding this.

BigRoux
Databricks Employee
Databricks Employee

Serverless is management free which means you cannot choose the image.  Hope this helps. Lou.

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now
OSZAR »