@@ -1074,10 +1074,16 @@ pub fn find_best_python_installation(
1074
1074
1075
1075
// First, check for an exact match (or the first available version if no Python version was provided)
1076
1076
debug ! ( "Looking for exact match for request {request}" ) ;
1077
- let result = find_python_installation ( request, environments, preference, cache) ?;
1078
- if let Ok ( ref installation) = result {
1079
- warn_on_unsupported_python ( installation. interpreter ( ) ) ;
1080
- return Ok ( result) ;
1077
+ let result = find_python_installation ( request, environments, preference, cache) ;
1078
+ match result {
1079
+ Ok ( Ok ( installation) ) => {
1080
+ warn_on_unsupported_python ( installation. interpreter ( ) ) ;
1081
+ return Ok ( Ok ( installation) ) ;
1082
+ }
1083
+ // Continue if we can't find a matching Python and ignore non-critical discovery errors
1084
+ Ok ( Err ( _) ) => { }
1085
+ Err ( ref err) if !err. is_critical ( ) => { }
1086
+ _ => return result,
1081
1087
}
1082
1088
1083
1089
// If that fails, and a specific patch version was requested try again allowing a
@@ -1096,10 +1102,16 @@ pub fn find_best_python_installation(
1096
1102
_ => None ,
1097
1103
} {
1098
1104
debug ! ( "Looking for relaxed patch version {request}" ) ;
1099
- let result = find_python_installation ( & request, environments, preference, cache) ?;
1100
- if let Ok ( ref installation) = result {
1101
- warn_on_unsupported_python ( installation. interpreter ( ) ) ;
1102
- return Ok ( result) ;
1105
+ let result = find_python_installation ( & request, environments, preference, cache) ;
1106
+ match result {
1107
+ Ok ( Ok ( installation) ) => {
1108
+ warn_on_unsupported_python ( installation. interpreter ( ) ) ;
1109
+ return Ok ( Ok ( installation) ) ;
1110
+ }
1111
+ // Continue if we can't find a matching Python and ignore non-critical discovery errors
1112
+ Ok ( Err ( _) ) => { }
1113
+ Err ( ref err) if !err. is_critical ( ) => { }
1114
+ _ => return result,
1103
1115
}
1104
1116
}
1105
1117
0 commit comments