databricks/databricks-vscode

[BUG] Configure autocomplete doesn't install packages

jhickson opened this issue · 2 comments

Describe the bug

Running "Databricks: Configure autocomplete for Databricks globals" silently fails to install packages into the local Python environment. I get as far as the first dialog box asking if I what to configure, but there's nothing after that.

After doing a bit of digging in the extension.js file I ended up reverting the call to executeInProcessE here to a call to executeInTerminalE as it was prior to the latest release (0.3.9). That showed the following error in the terminal (Powershell):

PS C:\Work\Code\Databricks\***> c:\Work\Code\Databricks\***\.venv\Scripts\python.exe -m pip list --format json --disable-pip-version-check --no-python-version-warning | c:\Work\Code\Databricks\***\.venv\Scripts\python.exe -c "import json; ip=json.loads(input()); fp=list(filter(lambda x: x[\"name\"] == \"databricks-connect\" , ip)); exit(0 if len(fp) >= 1 else 1);"; echo $? > C:\Users\***\AppData\Local\Temp\databricks-vscode-qx31ZR\python-terminal-output.txt
  File "<string>", line 1
    import json; ip=json.loads(input()); fp=list(filter(lambda x: x[" name\]
                                                                    ^
SyntaxError: unterminated string literal (detected at line 1)

I was able to fix this manually in the terminal by changing the \" instances to ' but all attempts to resolve this in the original JavaScript have failed.

To Reproduce
Steps to reproduce the behavior:

  1. Open empty folder and create venv Python environment via Ctrl-Shift-p -> "Python: Create environment"
  2. Type Ctrl-Shift-p
  3. Enter Databricks: Configure autocomplete for Databricks globals
  4. Click Configure
  5. Nothing happens - you can manually check if the databricks-connect package has been installed and there will be nothing.

System information:

Version: 1.77.3 (user setup)
Commit: 704ed70d4fd1c6bd6342c436f1ede30d1cff4710
Date: 2023-04-12T09:16:02.548Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Windows_NT x64 10.0.19045
Sandboxed: No

Databricks Extension Version = v0.3.9

Databricks Extension Logs
No logs

@jhickson thanks for digging into this issue so thoroughly! I have merged a fix (validated to run on powershell). I am preparing a hotfix now.

Update: The hotfix is released now.

@kartikgupta-db thanks for fixing that so quickly - I can confirm it's working now.