cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to deploy a python script with dependencies by dbx?

dslin
New Contributor III

Hi,

I'm quite new here. I'm trying to perform a deployment of python file with dbx command. The file contains libraries to be installed. How may I deploy the file (together with its dependencies) to databricks?

Here are the commands I currently run:

`dbx deploy --job=Sample-Training-Job-File --no-rebuild`

`dbx launch --job=Sample-Training-Job-File --trace`

And my `Sample-Training-Job-File` is specified in the `depployment.yml` as follows. This is a databricks in Azure.

```

environments:

default:

strict_path_adjustment_policy: true

jobs:

- name: "Sample-Training-Job-File"

new_cluster:

spark_version: "10.4.x-scala2.12"

num_workers: 1

node_type_id: "Standard_DS3_v2"

spark_python_task:

python_file: "file://sample/training_file.py"

```

Thank you.

3 REPLIES 3

Prabakar
Esteemed Contributor III
Esteemed Contributor III

@Di Lin​ are you facing any errors while using this code?

dslin
New Contributor III
Hi Prabakar,
Yes, I would have import error if I deploy the code this way. Because the packages (e.g. mlflow, sklearn) are not installed.

Vidula
Honored Contributor

Hi @Di Lin​ 

Hope all is well! Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or mark an answer as best? Else please let us know if you need more help. 

We'd love to hear from you.

Thanks!

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!