-
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
integreted powershell's PATH env variables contains unexpected '.' #22073
Comments
Experiencing exactly the same (1.82.2) - I first had the changes a
notice the period in front of C - haven't dug deeper so far except my path has the period added in front of the _javapath::
What is the same for me as it is for @FranciscoFang is that the period seems to be inserted as the last position of the part that is appended to my path inside VS Code - i.e. running a |
This happens to me too (PowerShell 5.1.19041.3031, Conda 23.5.0, via Remote SSH, additional version info below), A workaround for this is placing the following line at the top of the
Version infoVersion: 1.82.2 (user setup) |
To help whoever gets to try to debug this, the temporary workaround mentioned here seems to be effective, but may require juggling between repos if you don't catch it the first time: EDIT: Example errors from broken integrated terminal (which VSC comments "Shell integration failed to activate"):
Path comparison Normal powershell window:
Integrated powershell terminal in VSCode, where the described errors occur:
By the looks of it, when the shell integration fails, the terminal duplicates (or at least ends up with duplicates of) the ENV values for its session, but in the duplicate section it mangles the python declaration with this '.C' business. All the other file paths are normal. (Asking VSC to "Show environment contributions" produces identical PATH parameters for all terminals, regardless of the integration failing or succeeding. '.C:\Python311' is not present there, but there is a curious ";.;" present that doesn't map to any entry shown when inspecting environment variables in Windows Settings UI. Snippet below:
If I succeed with the 'pip' workaround linked above, the comment from VSC will change to "Shell integration activated" and the ENV paths will be as expected (with no duplicates or mangled Python path). |
Related on Stack Overflow: Conda Env and Python extension make WinError123 in Visual Studio Code Also, I wonder if this is related to #11039 ? |
Hi all, Fix should be out in the pre-release version of the extension, use the following to try it out: Dup of #22047. |
Seeing that this has been "fixed" I must admit I am not that happy with this "feature" in the first place. I have personally disabled activation of environments altogether:
I'll wait until it's all ironed out. Also, the description and notification messages are quite hard to follow. I'm less comfortable with the wrong environment possibly showing up in the prompt than I am with polluting terminal history. Is there a way to choose how I'd like my environment to be activated? Can you switch this back until you have all the issues ironed out, or at least enable a flag to temporarily disable the new method while this is still under development? Also, when this setting is enabled, it looks like the |
This feature is currently behind an experiment, feel free to add the following User setting to temporarily opt out:
We plan to make this the default experience going forward, and would very much appreciate it if you could help with the specifics which makes it hard to follow, or any other feedback to improve it.
That's currently a limitation we're hoping to solve in the future with microsoft/vscode#145234. But things should still work as expected even with the limiation. |
I tried switching to pre-release version but the error still persists. |
@ngquocanh1197 Can you confirm that you reloaded the window and reopened terminals after install finished? |
@karrtikr Sorry for the confusion, it's working now. I probably forgot to reload everything. |
I tried to switch to the pre-release version and reloaded / reopened everything. It works now, but every time I open VSC I get spammed by this error messages:
|
Please create a new issue as directed in https://github.com/microsoft/vscode-python/wiki/Reporting-a-bug and we'll be happy to take a look. Meanwhile you can switch to Pylance to unblock yourself. (Set |
Thanks for you help. Can you explain to some one how only ever interacted with the UI and doesn't know where to find setting files, how to set the |
I am getting very similar issue and have tried updating to the pre-release version but did not resolve it. In my case the path variable is getting duplicated as above but there is no separator being added between the existing PATH and what appears to be added as ${env:PATH}, "...C:\Users\joltman\AppData\Local\Programs\Microsoft VS Code\bin${env:PATH}`". Debugging in VS Code continues to work, but things like a "conda list" command are failing with an error like... I was able to disable the "Active Python Environment in all Terminals created." and then manually activate the env using "conda activate env" without seeing the issue. |
@joltman61 You may need to reload the window. @Felix-Meyer https://code.visualstudio.com/docs/getstarted/settings I recommend folks to create a new issue rather than comments which are less likely to be tracked. |
Steps to Reproduce:
This is a very weird issue that integreted powershell doesn't share the same PATH env variables with the outside powershell 7.
I installed anaconda, mainly for python dev.
Debugging python codes with vscode integreted powershell is successful, but when i wanna use the integreted powershell to do other works(e.g. pip install a whl), it always turns out to be "set-Item: Cannot find drive. A drive with the name '.D' does not exist." error.
Last time i saw this kind of error, i found " '.C' does not exist", and i checked the $env:PATH, find a value is written '.C:/(...)', i used set-Item command removed the value and it started to work properly.
But after a rebooting my computer, it turns out to be the same with "Cannot find drive. A drive with the name '.D' does not exist". however, this time i cannot use set-Item to fix it, the error report is the same 'Cannot find drive'. The $env:PATH has a lot of dumplicates since a .D occurred, and I cannot remove the .D line anymore.
This issue is quite similar to microsoft/vscode#74606, but i don't know if they are really the same.
the outside powershell 7's $env:PATH:
C:\Program Files\PowerShell\7;D:\anaconda3\Scripts;D:\anaconda3\envs\tf-gpu\Library\bin;C:\Windows\system32;D:\Git\cmd;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.0\libnvvp;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\NVIDIA Corporation\Nsight Compute 2022.4.0;C:\Program Files\PowerShell\7;C:\Users\liquid\AppData\Local\Microsoft\WindowsApps;D:\Microsoft VS Code\bin
the integreted powershell 7's $env:PATH:
C:\Program Files\PowerShell\7;D:\anaconda3\envs\tf-gpu;D:\anaconda3\envs\tf-gpu\Library\mingw-w64\bin;D:\anaconda3\envs\tf-gpu\Library\usr\bin;D:\anaconda3\envs\tf-gpu\Library\bin;D:\anaconda3\envs\tf-gpu\Scripts;D:\anaconda3\envs\tf-gpu\bin;D:\anaconda3\condabin;C:\Program Files\PowerShell\7;D:\anaconda3\Scripts;D:\anaconda3\envs\tf-gpu\Library\bin;C:\Windows\system32;D:\Git\cmd;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.0\libnvvp;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\NVIDIA Corporation\Nsight Compute 2022.4.0;C:\Program Files\PowerShell\7;C:\Users\liquid\AppData\Local\Microsoft\WindowsApps;D:\anaconda3\envs\tf-gpu\Library\bin;D:\anaconda3\Scripts;D:\Microsoft VS Code\bin;.D:\anaconda3\Scripts;D:\anaconda3\envs\tf-gpu\Library\bin;C:\Windows\system32;D:\Git\cmd;C:\Program Files\NVIDIA GPU
Computing Toolkit\CUDA\v12.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.0\libnvvp;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\NVIDIA Corporation\Nsight Compute 2022.4.0;C:\Program Files\PowerShell\7;C:\Users\liquid\AppData\Local\Microsoft\WindowsApps;D:\anaconda3\envs\tf-gpu\Library\bin;D:\anaconda3\Scripts;D:\Microsoft VS Code\bin;
the '.D' is with '.D:\anaconda3\Scripts'
The text was updated successfully, but these errors were encountered: