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 uninstall libraries that are set to auto-install on all cluster - using REST API

brickster_2018
Esteemed Contributor
Esteemed Contributor

I have a bunch of libraries that I want to uninstall. All of them are marked as auto-install.

1 ACCEPTED SOLUTION

Accepted Solutions

brickster_2018
Esteemed Contributor
Esteemed Contributor

1) Find the corresponding library definition from an existing cluster using "libraries/cluster-status?cluster_id=<cluster_id>".

$ curl -X GET 'https://cust-success.cloud.databricks.com/api/2.0/libraries/cluster-status?cluster_id=1226-232931-cuffs129' -H 'Content-Type: application/json' -H "Authorization: Bearer MY_TOKEN"
 
{"cluster_id":"1226-232931-cuffs129","library_statuses":[{"library":{"pypi":{"package":"pyhive"}},"status":"INSTALLED","is_library_for_all_clusters":true}]}

2) Use "libraries/uninstall-library-on-all-clusters" to uninstall library using definition found with step 1:

$request_body=$(cat <<EOF
{
    "library": {
        "pypi": {
            "package": "pyhive"
            }
    }
}
EOF
)
  
$ curl -X POST 'https://cust-success.cloud.databricks.com/api/2.0/libraries/uninstall-library-on-all-clusters' -H 'Content-Type: application/json' -H "Authorization: Bearer MY_TOKEN" -d "$request_body"

3) Verify the library status from UI. The running clusters would need to be restarted to uninstallation to take into effect.

View solution in original post

1 REPLY 1

brickster_2018
Esteemed Contributor
Esteemed Contributor

1) Find the corresponding library definition from an existing cluster using "libraries/cluster-status?cluster_id=<cluster_id>".

$ curl -X GET 'https://cust-success.cloud.databricks.com/api/2.0/libraries/cluster-status?cluster_id=1226-232931-cuffs129' -H 'Content-Type: application/json' -H "Authorization: Bearer MY_TOKEN"
 
{"cluster_id":"1226-232931-cuffs129","library_statuses":[{"library":{"pypi":{"package":"pyhive"}},"status":"INSTALLED","is_library_for_all_clusters":true}]}

2) Use "libraries/uninstall-library-on-all-clusters" to uninstall library using definition found with step 1:

$request_body=$(cat <<EOF
{
    "library": {
        "pypi": {
            "package": "pyhive"
            }
    }
}
EOF
)
  
$ curl -X POST 'https://cust-success.cloud.databricks.com/api/2.0/libraries/uninstall-library-on-all-clusters' -H 'Content-Type: application/json' -H "Authorization: Bearer MY_TOKEN" -d "$request_body"

3) Verify the library status from UI. The running clusters would need to be restarted to uninstallation to take into effect.

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!