0

I installed the Databricks CLI, but I am unable to work with the library as such:

In powershell, I have set the working directory to: C:\Users\DNaught1\AppData\Local\Programs\Python\Python39\Scripts

I know the module is there:

Mode LastWriteTime Length Name

-a---- 13/10/2020 1:46 PM 74752 databricks.exe**

I then try to see the version but no luck as shown below:

PS C:\Users\DNaught1\AppData\Local\Programs\Python\Python39\Scripts> databricks --version

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. At line:1 char:1

  • databricks --version
  •   + CategoryInfo          : ObjectNotFound: (databricks:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    
    

Suggestion [3,General]: The command databricks was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\databricks". See "get-help about_Command_Precedence" for more details.

Alex Ott
  • 80,552
  • 8
  • 87
  • 132
dale
  • 17
  • 2
  • 4
  • Does this answer your question? [Executing an EXE file using a PowerShell script](https://stackoverflow.com/questions/4639894/executing-an-exe-file-using-a-powershell-script) – marsze Oct 13 '20 at 08:48
  • Use `.\databricks.exe --version` – marsze Oct 13 '20 at 08:49

1 Answers1

0

I managed to work around it by using the following:

1- In Python use the command below to install the CLI module

package_names=['databricks-cli', 'requests'] #packages to install
pip.main(['install'] + package_names + ['--upgrade'])

2- In powershell cli: change the context to the working directory:

Set-Location -Path C:\Users\DNaught1\AppData\Local\Programs\Python\Python39\Scripts

3 - Configure the databricks cli:

.\databricks.exe configure--token
.\databricks configure --token
Host: https://xxx.azuredatabricks.net
Token: dapi2b2dxxxxxxxxxa02c9e6866d322 - Access token for Secrets

4 - Write-host Configuration file for databricks access

Set-Content .databrickscfg "[DEFAULT]"
>> Add-Content .databrickscfg "host = https://xxx.azuredatabricks.net"
>> Add-Content .databrickscfg "token = dapi2b2dxxxxxxxxxa02c9e6866d322"

5 - Validate by checking file storage

.\dbfs ls
dale
  • 17
  • 2
  • 4
  • I still get the error as its not recognized. Can you please help? ```PS C:\Program Files\PowerShell\7> pip install databricks-cli Requirement already satisfied: databricks-cli in c:\python310\lib\site-packages (0.16.6) Requirement already satisfied: requests>=2.17.3 in c:\python310\lib\site-packages (from databricks-cli) (2.27.1) Requirement already satisfied: oauthlib>=3.1.0 in c:\python310\lib\site-packages (from databricks-cli) (3.2.0) Requirement already satisfied: click>=6.7 in c:\python310\lib\site-packages (from databricks-cli) (8.1.3) ``` – Ak777 May 17 '22 at 08:10
  • ```Requirement already satisfied: tabulate>=0.7.7 in c:\python310\lib\site-packages (from databricks-cli) (0.8.9) Requirement already satisfied: pyjwt>=1.7.0 in c:\python310\lib\site-packages (from databricks-cli) (2.3.0) Requirement already satisfied: six>=1.10.0 in c:\python310\lib\site-packages (from databricks-cli) (1.16.0) Requirement already satisfied: colorama in c:\python310\lib\site-packages (from click>=6.7->databricks-cli) (0.4.4) Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\python310\lib\site-packages (from requests>=2.17.3->databricks-cli) (1.26.7) ``` – Ak777 May 17 '22 at 08:10
  • ```Requirement already satisfied: certifi>=2017.4.17 in c:\python310\lib\site-packages (from requests>=2.17.3->databricks-cli) (2021.10.8) Requirement already satisfied: idna<4,>=2.5 in c:\python310\lib\site-packages (from requests>=2.17.3->databricks-cli) (3.3) Requirement already satisfied: charset-normalizer~=2.0.0 in c:\python310\lib\site-packages (from requests>=2.17.3->databricks-cli) (2.0.10) ``` – Ak777 May 17 '22 at 08:11
  • ```PS C:\Program Files\PowerShell\7> databricks -v databricks: The term 'databricks' is not recognized as a name of a cmdlet, function, script file, or executable program.Check the spelling of the name, or if a path was included, verify that the path is correct and try again.``` – Ak777 May 17 '22 at 08:11