cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Machine Learning
Dive into the world of machine learning on the Databricks platform. Explore discussions on algorithms, model training, deployment, and more. Connect with ML enthusiasts and experts.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Uninstall whl file from databricks cluster via CLI

Visakh_Vijayan
New Contributor II

Hello, we have a need to uninstall older versions of whl files from personal cluster via databricks CLI - could you please provide the exact command to be used here. We tried with many found on the documentations but none of them worked to do the actual uninstall. Please help here. Thanks ! 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Visakh_Vijayan ,

Sorry for late response, I didn't notice your reply. So I prepared simple example. Here I installed whl file on a cluster using below command:

 

 

databricks libraries install --json `@libraries_to_install.json

 

 

szymon_dybczak_0-1726513092476.png

The content of libraries_to_install.json file looks following:

{
  "cluster_id": "your_cluster_id",
  "libraries": [
    {
      "whl": "/Workspace/Users/path_to_your_wheel/my_package-0.1-py2.py3-none-any.whl"
    }
  ]
}

 

 

 

As a result I have installed whl library on cluster:

szymon_dybczak_1-1726513269180.png

Now, to uninstall library I used below command:

 

 

 

databricks libraries uninstall --json `@libraries_to_uninstall.json

 

 

The content of libraries_to_uninstall.json is following:

 

 

{
  "cluster_id": "your_cluster_id",
  "libraries": [
    {
      "whl": "/Workspace/Users/path_to_your_wheel/my_package-0.1-py2.py3-none-any.whl"
    }
  ]
}

 

 

After cluster restarted, wheel library uninstalled successfully .

Edit: If you use powershell terminal use backtick to escape @ character `@libraries_to_uninstall.json

View solution in original post

5 REPLIES 5

michael569gardn
New Contributor III

This topic is a very nice Official Site
Thank you for sharing

szymon_dybczak
Contributor III

Hi @Visakh_Vijayan ,

Did you try to use databricks libraries uninstall? It's exactly crafted for this purpose

databricks libraries uninstall --json YOUR_JSON_WITH_REQUEST_BODY

Also, when you uninstall a library from a cluster, the library is removed only when you restart the cluster. Until you restart the cluster, the status of the uninstalled library appears as Uninstall pending restart.

 

 

Thanks for the immediate response ! Yes, we tried with an inline JSON string and executed it and the command went through without any success or failure messages but didn't do anything. The whl file was still there in the cluster even after a restart so we had to mark this as failed. The older CLI had an uninstall all libraries method. Is that still supported ? If not could you please send across a command with an actual JSON string with a dummy whl file ? We will compare if there were any formatting issues on our end and was the reason the uninstall didn't happen. Btw, we are using databricks CLI 0.227.1

Hi @Visakh_Vijayan ,

Sorry for late response, I didn't notice your reply. So I prepared simple example. Here I installed whl file on a cluster using below command:

 

 

databricks libraries install --json `@libraries_to_install.json

 

 

szymon_dybczak_0-1726513092476.png

The content of libraries_to_install.json file looks following:

{
  "cluster_id": "your_cluster_id",
  "libraries": [
    {
      "whl": "/Workspace/Users/path_to_your_wheel/my_package-0.1-py2.py3-none-any.whl"
    }
  ]
}

 

 

 

As a result I have installed whl library on cluster:

szymon_dybczak_1-1726513269180.png

Now, to uninstall library I used below command:

 

 

 

databricks libraries uninstall --json `@libraries_to_uninstall.json

 

 

The content of libraries_to_uninstall.json is following:

 

 

{
  "cluster_id": "your_cluster_id",
  "libraries": [
    {
      "whl": "/Workspace/Users/path_to_your_wheel/my_package-0.1-py2.py3-none-any.whl"
    }
  ]
}

 

 

After cluster restarted, wheel library uninstalled successfully .

Edit: If you use powershell terminal use backtick to escape @ character `@libraries_to_uninstall.json

Thanks a bunch ! Yep, that worked like a charm - appreciate the detailing of the solution ๐Ÿ™‚  

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