Fix wrong Python executable path on Linux/macOS after creating conda environments#1459
Open
StellaHuang95 wants to merge 1 commit intomicrosoft:mainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1454
Bug
In
createNamedCondaEnvironmentandcreatePrefixCondaEnvironment, the Python executable path is computed as:On Linux/macOS, this produces
/path/to/env/python, but conda installs the Python executable at/path/to/env/bin/python.Why it's a bug
The environment appears in the VS Code picker and can be selected. However, the internal
execInfo.run.executablepoints to a non-existent path. Any operation that invokes Python — running scripts, linting, getting version info — fails silently. Users see a valid-looking conda environment that they can select, but nothing works after selecting it.The
quickCreateCondafunction (line 1225) already had the correct path:Repro steps
/path/to/env/pythondoes not exist.Fix
Changed both
createNamedCondaEnvironment(line 1085) andcreatePrefixCondaEnvironment(line 1169) to use:This matches the correct pattern already used in
quickCreateConda.Tests added
condaUtils.pythonExePath.unit.test.ts: 3 test cases verifying correct executable paths for both platform types and both environment types.