You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When both the Python extension and Databricks extension are enabled in VS.Code, the Databricks extension somehow overwrites the venv's PATH environment variable in terminals, running/debugging Python scripts and also executing tests.
With both extensions installed, only the Databricks PATH is applied. This means that all other Python modules, ie. pip, aren't found in the right virtual environment as well as Python itself.
This happens, regardless of whether or not Databricks Connect is enabled.
Details:
The Python VS.Code extension prepends .venv execution directories in the PATH:
you can see that the Virtual Environment's prepended PATH is missing.
To Reproduce
have both the Python VS.Code extension and Databricks VS.Code extension installed and enabled.
Create a Python Virtual Environment
Run a PowerShell terminal and look at $env:PATH
or run this simple script
import sys, os
import shutil
print(sys.version)
print(shutil.which("python"))
for name, value in os.environ.items():
print("{0}: {1}".format(name, value))
Screenshots
this can be inspected by hovering over a terminal window and selecting "Show Environment Contributions"
You can then see what is happening:
(You can also see that somehow the Databricks authorisation variables are somehow listed as coming from the activated environment, but that's not right. Maybe it's related)
for what it's worth, the rest of the environment seems ok, other than the duplicated Databricks authorisation.
System information:
Paste the output ot the Help: About command (CMD-Shift-P).
Hi @ksamborn. What version of the python extension are you on? Can you try with an older version of the python extension (2023.16 for example). I seem to have observed similar behaviour. I did not investigate the path issue, but the python environment was not getting updated. Downgrading seems to have fixed everything.
Hi Kartik - I apologise - I didn't try. After your comment, I went and looked at the VS.Code python extension open issues and there are many in this area. I think I will wait for them to fix it...
In the meantime, I can just manually set the PATH, and with Databricks Connect, PYSPARK_PYTHON isn't necessary.
When both the Python extension and Databricks extension are enabled in VS.Code, the Databricks extension somehow overwrites the venv's PATH environment variable in terminals, running/debugging Python scripts and also executing tests.
With both extensions installed, only the Databricks PATH is applied. This means that all other Python modules, ie. pip, aren't found in the right virtual environment as well as Python itself.
This happens, regardless of whether or not Databricks Connect is enabled.
Details:
The Python VS.Code extension prepends .venv execution directories in the PATH:
and the Databricks extension does something similar:
PATH when the Databricks extension is disabled or not installed:
PATH when the Databricks extension is enabled:
you can see that the Virtual Environment's prepended PATH is missing.
To Reproduce
have both the Python VS.Code extension and Databricks VS.Code extension installed and enabled.
Create a Python Virtual Environment
Run a PowerShell terminal and look at $env:PATH
or run this simple script
Screenshots
this can be inspected by hovering over a terminal window and selecting "Show Environment Contributions"
You can then see what is happening:
(You can also see that somehow the Databricks authorisation variables are somehow listed as coming from the activated environment, but that's not right. Maybe it's related)
for what it's worth, the rest of the environment seems ok, other than the duplicated Databricks authorisation.
System information:
Help: About
command (CMD-Shift-P).Version: 1.86.2 (user setup)
Commit: 903b1e9d8990623e3d7da1df3d33db3e42d80eda
Date: 2024-02-13T19:40:56.878Z
Electron: 27.2.3
ElectronBuildId: 26908389
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Windows_NT x64 10.0.19045
v1.2.7
The text was updated successfully, but these errors were encountered: