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
Databricks Employee
Databricks Employee

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
Databricks Employee
Databricks Employee

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
Databricks Employee
Databricks Employee

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.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group