How to install databricks command line tool in linux and windows


Sometimes we need to interact with databricks command line to get work done, for example, create new secrets scope and key.

Install the databricks command line in linux or MAC OS is pretty easy:

pip install databricks-cli

or if you want to install the latest version, do this:

pip install databricks-cli --upgrade

After the the package is installed, check to see if it’s working:

databricks --version

Install the databricks command line in Windows will take longer time.
First, we still need to install the databricks-cli library, go to your python environment in windows, such as Anaconda:

pip install databricks-cli

Now if we try the databricks command, it might complain with this error:

databricks : The term 'databricks' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.

This is because the command is not in the default system PATH. To add the databricks command in the system path in windows,
First observe where the databricks-cli library is installed, you might see this:

Requirement already satisfied: databricks-cli in c:\users\<yourusername>\appdata\roaming\python\python38\site-packages (0.17.3)

Or just run

pip --version

You will see the pip path under windows; Usually the python package is installed under the same directory as pip. However this is not true all the time,
so the safest method is still trying to figure out the path by checking the specific package you just installed.

Now, the databricks command installation path should be as the following:

C:\Users\<yourusername>\AppData\Roaming\Python\Python38\Scripts\databricks.exe

We can use the command with the whole path, or we could put the following path in the system path in windows:

C:\Users\<yourusername>\AppData\Roaming\Python\Python38\Scripts\

Search “Edit the system environment variable” in windows, and add the above path as a new variable under PATH:

After the above step, you can try this command again, and it should be working:

--version


Author: robot learner
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source robot learner !
  TOC