Skip to content

Commit 86da867

Browse files
authored
fix: update run command for conda to use python instead of conda run (#860)
fixes #839 ## BEFORE the behavior was: ### with envs ext `conda activate conda-run-env` `conda run --name conda-run-env python /Users/eleanorboyd/testing/by-issue-env/conda-run/script_abc.py` ### without envs ext `/Users/eleanorboyd/miniforge3/envs/conda-run-env/bin/python /Users/eleanorboyd/testing/by-issue-env/conda-run/script_abc.py` ## NEW behavior for envs ext: 1. `conda activate conda-run-env` 2. `/Users/eleanorboyd/miniforge3/envs/conda-run-env/bin/python /Users/eleanorboyd/testing/by-issue-env/conda-run/script_abc.py`
1 parent 03f82dc commit 86da867

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/managers/conda/condaUtils.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ async function getNamedCondaPythonInfo(
331331
execInfo: {
332332
run: { executable: path.join(executable) },
333333
activatedRun: {
334-
executable: 'conda',
335-
args: ['run', '--name', name, 'python'],
334+
executable: path.join(executable),
335+
args: [],
336336
},
337337
activation: [{ executable: 'conda', args: ['activate', name] }],
338338
deactivation: [{ executable: 'conda', args: ['deactivate'] }],
@@ -376,8 +376,8 @@ async function getPrefixesCondaPythonInfo(
376376
execInfo: {
377377
run: { executable: path.join(executable) },
378378
activatedRun: {
379-
executable: conda,
380-
args: ['run', '--prefix', prefix, 'python'],
379+
executable: path.join(executable),
380+
args: [],
381381
},
382382
activation: [{ executable: conda, args: ['activate', prefix] }],
383383
deactivation: [{ executable: conda, args: ['deactivate'] }],
@@ -991,6 +991,7 @@ export async function quickCreateConda(
991991
additionalPackages?: string[],
992992
): Promise<PythonEnvironment | undefined> {
993993
const prefix = path.join(fsPath, name);
994+
const execPath = os.platform() === 'win32' ? path.join(prefix, 'python.exe') : path.join(prefix, 'bin', 'python');
994995

995996
return await withProgress(
996997
{
@@ -999,7 +1000,6 @@ export async function quickCreateConda(
9991000
},
10001001
async () => {
10011002
try {
1002-
const bin = os.platform() === 'win32' ? 'python.exe' : 'python';
10031003
await runCondaExecutable(['create', '--yes', '--prefix', prefix, 'python'], log);
10041004
if (additionalPackages && additionalPackages.length > 0) {
10051005
await runConda(['install', '--yes', '--prefix', prefix, ...additionalPackages], log);
@@ -1015,10 +1015,10 @@ export async function quickCreateConda(
10151015
description: prefix,
10161016
version,
10171017
execInfo: {
1018-
run: { executable: path.join(prefix, bin) },
1018+
run: { executable: execPath },
10191019
activatedRun: {
1020-
executable: 'conda',
1021-
args: ['run', '-p', prefix, 'python'],
1020+
executable: execPath,
1021+
args: [],
10221022
},
10231023
activation: [{ executable: 'conda', args: ['activate', prefix] }],
10241024
deactivation: [{ executable: 'conda', args: ['deactivate'] }],

0 commit comments

Comments
 (0)