@@ -158,35 +158,34 @@ async function resolveSimpleEnv(env: BasicEnvInfo): Promise<PythonEnvInfo> {
158158async function resolveCondaEnv ( env : BasicEnvInfo ) : Promise < PythonEnvInfo > {
159159 const { executablePath } = env ;
160160 const conda = await Conda . getConda ( ) ;
161- if ( conda === undefined || ! env . envPath ) {
162- const errorMsg =
163- conda === undefined
164- ? `${ executablePath } identified as Conda environment even though Conda is not found`
165- : `Conda environment ${ executablePath } does not have envPath` ;
166- traceError ( errorMsg ) ;
161+ if ( conda === undefined ) {
162+ traceWarn ( `${ executablePath } identified as Conda environment even though Conda is not found` ) ;
167163 // Environment could still be valid, resolve as a simple env.
168164 env . kind = PythonEnvKind . Unknown ;
169165 const envInfo = await resolveSimpleEnv ( env ) ;
170166 envInfo . type = PythonEnvType . Conda ;
167+ // Assume it's a prefixed env by default because prefixed CLIs work even for named environments.
168+ envInfo . name = '' ;
171169 return envInfo ;
172170 }
173171
172+ const envPath = env . envPath ?? getEnvironmentDirFromPath ( env . executablePath ) ;
174173 let executable : string ;
175174 if ( env . executablePath . length > 0 ) {
176175 executable = env . executablePath ;
177176 } else {
178- executable = await conda . getInterpreterPathForEnvironment ( { prefix : env . envPath } ) ;
177+ executable = await conda . getInterpreterPathForEnvironment ( { prefix : envPath } ) ;
179178 }
180179 const info = buildEnvInfo ( {
181180 executable,
182181 kind : PythonEnvKind . Conda ,
183182 org : AnacondaCompanyName ,
184- location : env . envPath ,
183+ location : envPath ,
185184 source : [ ] ,
186185 version : executable ? await getPythonVersionFromPath ( executable ) : undefined ,
187186 type : PythonEnvType . Conda ,
188187 } ) ;
189- const name = await conda ?. getName ( env . envPath ) ;
188+ const name = await conda ?. getName ( envPath ) ;
190189 if ( name ) {
191190 info . name = name ;
192191 }
0 commit comments