Installing/Setting Up Databricks CLI

Databricks CLI is a command line interface to Databricks platform. This is built on top of databricks REST APIs. Its commands are organized into different API groups as –

  • workspace
  • clusters
  • instance pools
  • dbfs
  • groups
  • jobs
  • libraries and
  • secrets

To install this, you must have python installed on your machine. If it is python 3 then the version should be 3.6 and above and if it is python 2 then the version should be 2.7.9 and above. You can just navigate to another post to check the python version installed on your machine.

Next, you can run pip command “pip install databricks-cli” as shown in the snapshot below to install CLI. This will start with the download first and then will install it.

During the installation, you may see some warnings as shown in the below snapshot highlighted in yellow text.

First warning is about the location which is not in PATH environment variable and the second one is about some updates available for python modules. You may ignore the warnings as they are just warnings, not the errors. But if you ignore them specially the one for PATH environment variable, you will have use databricks CLI from the exact location on command prompt where it is installed. So, it’s advisable to address them so that you can use CLI environment smoothly without worrying about where it is installed.

So, let’s address the warnings. Upgrade warning can be handled by running the command “python -m pip install –upgrade pip” as shown in the below snapshot too –

For the second warning, you need to append the location “C:\Users\<user name>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts” to PATH environment variable. And don’t forget to replace <user name> with your own user directory name.

If you try to run the CLI installation command again, you will see that there are no warnings now –

This completes the installation and you may verify this by running “databricks” command on cmd prompt as shown below. You will notice the API names that we just mentioned at the beginning of this post –

Note that this has finished just the installation but to run any further commands against your databricks environment, you need to configure it by specifying your host URL and a token for authentication. Run the command “databricks configure –token” which will prompt for URL and token as –

URL, you can fetch from Azure resource interface –

and token is something that you can generate from databricks workspace by navigating to the user settings –

Note that the token you generate is not saved anywhere else so you need to preserve it at your own secure place and specify it here. After this, your databricks CLI is configured and ready for use against your environment.

You may find further details in Databricks’ official documentation.

One comment

Comments are closed.