@@ -222,8 +222,21 @@ export class CondaService implements ICondaService {
222
222
try {
223
223
const condaFile = await this . getCondaFile ( ) ;
224
224
const processService = await this . processServiceFactory . create ( ) ;
225
- const envInfo = await processService . exec ( condaFile , [ 'env' , 'list' ] ) . then ( output => output . stdout ) ;
225
+ let envInfo = await processService . exec ( condaFile , [ 'env' , 'list' ] ) . then ( output => output . stdout ) ;
226
226
traceVerbose ( `Conda Env List ${ envInfo } }` ) ;
227
+ if ( ! envInfo ) {
228
+ traceVerbose ( 'Conda env list failure, attempting path additions.' ) ;
229
+ // Try adding different folders to the path. Miniconda fails to run
230
+ // without them.
231
+ const baseFolder = path . dirname ( path . dirname ( condaFile ) ) ;
232
+ const binFolder = path . join ( baseFolder , 'bin' ) ;
233
+ const condaBinFolder = path . join ( baseFolder , 'condabin' ) ;
234
+ const libaryBinFolder = path . join ( baseFolder , 'library' , 'bin' ) ;
235
+ const newEnv = process . env ;
236
+ newEnv . PATH = `${ binFolder } ;${ condaBinFolder } ;${ libaryBinFolder } ;${ newEnv . PATH } ` ;
237
+ traceVerbose ( `Attempting new path for conda env list: ${ newEnv . PATH } ` ) ;
238
+ envInfo = await processService . exec ( condaFile , [ 'env' , 'list' ] , { env : newEnv } ) . then ( output => output . stdout ) ;
239
+ }
227
240
const environments = this . condaHelper . parseCondaEnvironmentNames ( envInfo ) ;
228
241
await globalPersistence . updateValue ( { data : environments } ) ;
229
242
return environments ;
0 commit comments