Skip to content
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

Get activate env vars for non-conda as well #9163

Merged
merged 3 commits into from
Mar 2, 2022
Merged

Conversation

DonJayamanne
Copy link
Contributor

Fixes #9089

@DonJayamanne DonJayamanne requested a review from a team as a code owner March 1, 2022 03:26
@@ -51,7 +51,7 @@ export class KernelEnvironmentVariablesService {

let [customEditVars, interpreterEnv] = await Promise.all([
this.customEnvVars.getCustomEnvironmentVariables(resource).catch(noop),
interpreter && interpreter.envType == EnvironmentType.Conda
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was wrong, we should get activated env variables for Virtual Env, etc, not just Conda environments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will work for virtual environments

if (interpreter) {
const env = kernelEnv || process.env;
this.envVarsService.prependPath(env, path.dirname(interpreter.path));
return env;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fall back, if we do'nt have any env variables, then prefix PATH as we do in other cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will work for global interpreters

@DonJayamanne DonJayamanne merged commit bac1329 into main Mar 2, 2022
@DonJayamanne DonJayamanne deleted the fixShellExec branch March 2, 2022 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shell commands such as !pip !python !where python do not point to the right executable
2 participants