-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Slashes not escaped in paths when activating conda environments in Git Bash on Windows #11419
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
Comments
Hello @keithyipkw, thank you for reaching out. What is the value for Thanks! |
|
Is this from your user settings, or your workspace settings (the |
It is from my user settings. |
Sorry for the late reply @keithyipkw (was working on issues related to Windows Store installations of Python, so I had to scrub out and then setup conda again) but I couldn't reproduce your issue: What's the content of your Thank you! |
The activation command is correct if I select "base". It is wrong only if I select any other environments. .vscode/settings.json
The path for the interpreter is
For comparison, they are the following for "base"
|
When you write It's also pretty strange that you get a full length activation command ( How did you create the |
Which properties in which VS settings did you mean? settings.json in AppData
.vs/settings.json
It is a 2-step process for activating my base
Comparing to selecting a non-base env
I created my envs in Anaconda Prompt following this doc https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
|
Good news: I think we're getting closer to figuring out why you are getting 2 different activation commands 🔎 In condaActivationProvider.ts we have some code that activates environments differently depending on your version of conda:
Now, I know you mentioned in your original command that you use Anaconda 4.8.2, can you run the following commands outside of VS Code, and copy their output here, so we can try and narrow down where the extension trips up:
Thank you for your help! |
|
Ok, I think that's it: This is the logic to build the activation command if your conda version is > 4.6: vscode-python/src/client/common/terminal/environmentActivationProviders/condaActivationProvider.ts Lines 79 to 84 in 61b179b
However We have 2 issues here:
I'll update the title of this issue to focus on problem 2. Thank you again for your patience! Repro conditions:
|
Environment Path
A user's For instance, here's the output of running a
My Current Workaround for This IssueNote that this
Since I'm using Git Bash as my default VSC terminal, this all gets sourced when the VSC terminal starts the same way it does when I open the shell externally, and at the moment my usual workflow is precisely to run this
I suppose one obvious solution here would be to allow users to manually specify the full activation command they want to use rather than restricting it to just a single path (as in the current A Potential FixOutside if the ability to just specify a fully-custom command, there's a few different ways that I've determined that the
Note that the last one, double quoting, is particularly interesting, as the default windows CMD prompt also allows commands to be double-quoted, meaning that this single way of formatting it is portable across both shells. In the windows CMD:
In windows git bash:
It seems like a straightforward solution would be to modify the way the program generates this command string, to just always include double quotes even when the path its running doesn't seem to have any spaces or other characters that would need to be quoted/escaped under windows CMD. Based on my cursory perusal of the source code, it seems like the |
Has any progress been made on resolving this issue as I also suffer from it? Also - I've tried but not been able to get any output akin to what was described from the developers console when switching environments. Is there some debugging mode/level that I need to turn on first? Also, I've
But I've not found a way to disable it. Does it turn off when visual code restarts? |
The problem no longer exists in my system after updating my VC Code to the latest version, 1.69.1, from an ancient version. It becomes a two-step process same as cmd. I am not sure if the update or some changes to my environment before (if any) fixed the problem.
|
Upon opening a new Bash,
The correct command should be using escaped backslashes or forward slashes
Interestingly, the command for activating the base environment is
Environment data
"python.jediEnabled"
set to; more info How to update the language server to the latest stable version #3977): truepython.languageServer
setting: MicrosoftExpected behaviour
The environment is activated.
Actual behaviour
"command not found" is displayed.
Steps to reproduce:
Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
; turn on source maps to make any tracebacks be useful by runningEnable source map support for extension debugging
)Activating environments other than the base
Activiting the base
The text was updated successfully, but these errors were encountered: