cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
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

User16869510359
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

User16869510359
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

User16869510359
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.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.