-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python does not properly/consistently contribute to Powershell environment #23181
Comments
Hello @MarcelBigger Thanks for filing the issue. What happens if you opt out of pythonTerminalEnvVarActivation? |
On PC 2:Same error, with the difference of no environment changes
Diagnostic dataPowershell Environment of PC 2:Terminal Environment Changes otherwise empty Additional informationOn PC 2:VS Code version: Code 1.88.1 (e170252f762678dec6ca2cc69aba1570769a5d39, 2024-04-10T17:41:02.734Z) System Info
Extensions (4)
|
Another interesting change after the above addition to the user settings.json: When launching VS Code from Anaconda Navigator, the Powershell environment accepts commands, as before, but is different than before: Terminal Environment Changes Extension: ms-python.python Activated environment for
Extension: vscode.git Enables the following features: git auth provider
|
Can you replicate? |
@MarcelBigger Apologies for late response. I am not able to repro this. Also not sure if this is specific issue to Python extension in VS Code. We are having new experiment with the terminal activation where we would set the environment variables on behalf of user, so I suspected that had anything to do with your issue, but it seems like it is NOT since opting out of the experiment yield the same result for you. Are you able to repro this outside of VS Code? |
On the PC2 of the very first issue posting where |
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off. Happy Coding! |
The environment
is suprisingly different between starting VS Code from Anaconda Navigator and starting VS Code from the Windows start menu. What does this tell us? Anaconda Navigator start
Windows start
|
@MarcelBigger Not much that are red-flag there. PATH can be different on depending on how you launch VS Code. We are having new experiment with the terminal activation where we would set the environment variables on behalf of user, so I suspected that had anything to do with your issue, but it seems like it is NOT since opting out of the experiment yield the same result for you. Seems very highly likely how you set up your conda environment, pip are not correct. |
PATH is different. Isn't THAT the problem? With a Windows start, VS Code is not seeing the Python environment? |
I have no such setting. |
Hey @anthonykim1, this issue might need further attention. @MarcelBigger, you can help us out by closing this issue if the problem no longer exists, or adding more information. |
@anthonykim1, any progress? |
Hey @anthonykim1, this issue might need further attention. @MarcelBigger, you can help us out by closing this issue if the problem no longer exists, or adding more information. |
@anthonykim1, are you guys working on this issue? |
Check your settings UI.
If adding "python.experiments.optOutFrom": ["pythonTerminalEnvVarActivation"] has no effect on your PATH, then this is really surprising because we Python extension won't be contributing/fiddling with your PATH variables. Then the problem likely resides outside of extension. If the issue is coming from pythonTerminalEnvVarActivation, it will be worth tracking #24567 as there are multiple issues with this experiment. |
Type: Bug
Behaviour
Python does not properly/consistently contributed to Powershell environment. Two PCs with VS Code and Anaconda installations today with differing behaviors.
Steps to reproduce:
On PC 1:
All OK apart from the small fact that the Python virtual environment is not indicated in the Powershell prompt.
On PC 2:
Not OK.
All OK but steps 10 to 17 are probably indicative on what's going astray within VS Code.
PS C:\Users\Marcel> C:/Users/Marcel/anaconda3/Scripts/activate
PS C:\Users\Marcel> conda activate ETH_CAS_AIS_2024_py310
conda : The term 'conda' 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
conda activate ETH_CAS_AIS_2024_py310
CategoryInfo : ObjectNotFound: (conda:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
All not OK again.
Diagnostic data
Hovering over Powershell tab at each indicated step:
Powershell Environment of PC 1:
Terminal Environment Changes
Extension: ms-python.python
Activated environment for
~\anaconda3\envs\ETH_CAS_AIS_2024_py310\python.exe
CONDA_DEFAULT_ENV=ETH_CAS_AIS_2024_py310
CONDA_EXE=C:\Users\Marcel\anaconda3\Scripts\conda.exe
CONDA_PREFIX=C:\Users\Marcel\anaconda3\envs\ETH_CAS_AIS_2024_py310
CONDA_PROMPT_MODIFIER=(ETH_CAS_AIS_2024_py310)
CONDA_PYTHON_EXE=C:\Users\Marcel\anaconda3\python.exe
CONDA_ROOT=C:\Users\Marcel\anaconda3
CONDA_SHLVL=1
PATH=C:\Users\Marcel\anaconda3\envs\ETH_CAS_AIS_2024_py310;C:\Users\Marcel\anaconda3\envs\ETH_CAS_AIS_2024_py310\Library\mingw-w64\bin;C:\Users\Marcel\anaconda3\envs\ETH_CAS_AIS_2024_py310\Library\usr\bin;C:\Users\Marcel\anaconda3\envs\ETH_CAS_AIS_2024_py310\Library\bin;C:\Users\Marcel\anaconda3\envs\ETH_CAS_AIS_2024_py310\Scripts;C:\Users\Marcel\anaconda3\envs\ETH_CAS_AIS_2024_py310\bin;C:\Users\Marcel\anaconda3\condabin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;c:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;c:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Git\cmd;C:\Users\Marcel\AppData\Local\Microsoft\WindowsApps;C:\Users\Marcel\AppData\Local\Programs\Microsoft VS Code\bin;${env:PATH}
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL
PROMPT=(ETH_CAS_AIS_2024_py310) $P$G
PSMODULEPATH=C:\DATEN\My Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
PYTHONIOENCODING=utf-8
PYTHONUNBUFFERED=1
_CONDA_OLD_CHCP=437
Extension: vscode.git
Enables the following features: git auth provider
GIT_ASKPASS=c:\Users\Marcel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass.sh
VSCODE_GIT_ASKPASS_NODE=C:\Users\Marcel\AppData\Local\Programs\Microsoft VS Code\Code.exe
VSCODE_GIT_ASKPASS_EXTRA_ARGS=
VSCODE_GIT_ASKPASS_MAIN=c:\Users\Marcel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js
VSCODE_GIT_IPC_HANDLE=\\.\pipe\vscode-git-7cb2a134d4-sock
Powershell Environment of PC 2:
Terminal Environment Changes
Extension: vscode.git
Enables the following features: git auth provider
GIT_ASKPASS=c:\Users\Marcel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass.sh
VSCODE_GIT_ASKPASS_NODE=C:\Users\Marcel\AppData\Local\Programs\Microsoft VS Code\Code.exe
VSCODE_GIT_ASKPASS_EXTRA_ARGS=
VSCODE_GIT_ASKPASS_MAIN=c:\Users\Marcel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js
VSCODE_GIT_IPC_HANDLE=\\.\pipe\vscode-git-4d8f1d6a52-sock
Additional information
PC 1:
Extension version: 2024.4.0
VS Code version: Code 1.88.0 (5c3e652f63e798a5ac2f31ffd0d863669328dc4c, 2024-04-03T13:26:18.741Z)
OS version: Windows_NT x64 10.0.19045
Modes:
python.languageServer
setting: DefaultUser Settings
Installed Extensions
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
A/B Experiments
PC 2:
Extension version: 2024.4.0
VS Code version: Code 1.88.0 (5c3e652f63e798a5ac2f31ffd0d863669328dc4c, 2024-04-03T13:26:18.741Z)
OS version: Windows_NT x64 10.0.19045
Modes:
python.languageServer
setting: DefaultUser Settings
Installed Extensions
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
The text was updated successfully, but these errors were encountered: