44use crate :: {
55 conda_rc:: { get_conda_rc_search_paths, Condarc } ,
66 env_variables:: EnvVariables ,
7+ manager:: find_conda_binary,
78 utils:: { is_conda_env, is_conda_install} ,
89} ;
910use log:: trace;
@@ -265,6 +266,14 @@ pub fn get_known_conda_install_locations(
265266) -> Vec < PathBuf > {
266267 use pet_fs:: path:: norm_case;
267268
269+ // First, try to find conda from PATH - this handles conda installations on mapped drives
270+ // and other non-standard locations that aren't in the hardcoded search paths.
271+ let conda_from_path = if conda_executable. is_none ( ) {
272+ find_conda_binary ( env_vars)
273+ } else {
274+ None
275+ } ;
276+
268277 let user_profile = env_vars. userprofile . clone ( ) . unwrap_or_default ( ) ;
269278 let program_data = env_vars. programdata . clone ( ) . unwrap_or_default ( ) ;
270279 let all_user_profile = env_vars. allusersprofile . clone ( ) . unwrap_or_default ( ) ;
@@ -359,6 +368,10 @@ pub fn get_known_conda_install_locations(
359368 if let Some ( conda_dir) = get_conda_dir_from_exe ( conda_executable) {
360369 known_paths. push ( conda_dir) ;
361370 }
371+ // Add conda installation found from PATH (handles mapped drives and non-standard locations)
372+ if let Some ( conda_dir) = get_conda_dir_from_exe ( & conda_from_path) {
373+ known_paths. push ( conda_dir) ;
374+ }
362375 known_paths. sort ( ) ;
363376 known_paths. dedup ( ) ;
364377
@@ -370,6 +383,14 @@ pub fn get_known_conda_install_locations(
370383 env_vars : & EnvVariables ,
371384 conda_executable : & Option < PathBuf > ,
372385) -> Vec < PathBuf > {
386+ // First, try to find conda from PATH - this handles conda installations in
387+ // non-standard locations that aren't in the hardcoded search paths.
388+ let conda_from_path = if conda_executable. is_none ( ) {
389+ find_conda_binary ( env_vars)
390+ } else {
391+ None
392+ } ;
393+
373394 let mut known_paths = vec ! [
374395 // We need to look in `/anaconda3` and `/miniconda3` as well.
375396 PathBuf :: from( "/anaconda" ) ,
@@ -431,6 +452,10 @@ pub fn get_known_conda_install_locations(
431452 if let Some ( conda_dir) = get_conda_dir_from_exe ( conda_executable) {
432453 known_paths. push ( conda_dir) ;
433454 }
455+ // Add conda installation found from PATH (handles non-standard locations)
456+ if let Some ( conda_dir) = get_conda_dir_from_exe ( & conda_from_path) {
457+ known_paths. push ( conda_dir) ;
458+ }
434459 known_paths. sort ( ) ;
435460 known_paths. dedup ( ) ;
436461 known_paths. into_iter ( ) . filter ( |f| f. exists ( ) ) . collect ( )
0 commit comments