Skip to content

Commit f66cbe6

Browse files
committed
Don't use activate from inside conda environments
In contrast to virtualenv-created environments, conda environments are not activated from the inside. In constrast, the environment activation is done from the outside via the conda executable that created the environment. Fixes microsoft#4402
1 parent 8cd0996 commit f66cbe6

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/client/interpreter/locators/services/condaService.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -250,16 +250,6 @@ export class CondaService implements ICondaService {
250250
const condaExe = this.platform.isWindows ? 'conda.exe' : 'conda';
251251
const scriptsDir = this.platform.isWindows ? 'Scripts' : 'bin';
252252
const interpreterDir = interpreterPath ? path.dirname(interpreterPath) : '';
253-
let condaPath = path.join(interpreterDir, condaExe);
254-
if (await this.fileSystem.fileExists(condaPath)) {
255-
return condaPath;
256-
}
257-
// Conda path has changed locations, check the new location in the scripts directory after checking
258-
// the old location
259-
condaPath = path.join(interpreterDir, scriptsDir, condaExe);
260-
if (await this.fileSystem.fileExists(condaPath)) {
261-
return condaPath;
262-
}
263253

264254
// Might be in a situation where this is not the default python env, but rather one running
265255
// from a virtualenv
@@ -279,6 +269,17 @@ export class CondaService implements ICondaService {
279269
return condaPath;
280270
}
281271
}
272+
273+
let condaPath = path.join(interpreterDir, condaExe);
274+
if (await this.fileSystem.fileExists(condaPath)) {
275+
return condaPath;
276+
}
277+
// Conda path has changed locations, check the new location in the scripts directory after checking
278+
// the old location
279+
condaPath = path.join(interpreterDir, scriptsDir, condaExe);
280+
if (await this.fileSystem.fileExists(condaPath)) {
281+
return condaPath;
282+
}
282283
}
283284

284285
/**

0 commit comments

Comments
 (0)