You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
debug!("No downloads are available for {request}");
141
+
returnErr(err);
142
+
}
143
+
None
144
+
}
145
+
Err(err) | Ok(Err(err)) => {
146
+
if downloads_enabled {
147
+
// We failed to determine the platform information
148
+
returnErr(err.into());
149
+
}
150
+
None
151
+
}
152
+
};
153
+
154
+
letSome(download) = download else{
155
+
// N.B. We should only be in this case when downloads are disabled; when downloads are
156
+
// enabled, we should fail eagerly when something goes wrong with the download.
157
+
debug_assert!(!downloads_enabled);
129
158
returnErr(err);
130
159
};
131
160
132
-
debug!("Requested Python not found, checking for available download...");
133
-
matchSelf::fetch(
134
-
request.fill()?,
161
+
// If the download is available, but not usable, we attach a hint to the original error.
162
+
if !downloads_enabled {
163
+
match python_downloads {
164
+
PythonDownloads::Automatic => {}
165
+
PythonDownloads::Manual => {
166
+
returnErr(err.with_missing_python_hint(format!(
167
+
"A managed Python download is available for {request}, but Python downloads are set to 'manual', use `uv python install {request}` to install the required version"
168
+
)));
169
+
}
170
+
PythonDownloads::Never => {
171
+
returnErr(err.with_missing_python_hint(format!(
172
+
"A managed Python download is available for {request}, but Python downloads are set to 'never'"
173
+
)));
174
+
}
175
+
}
176
+
177
+
match preference {
178
+
PythonPreference::OnlySystem => {
179
+
returnErr(err.with_missing_python_hint(format!(
180
+
"A managed Python download is available for {request}, but the Python preference is set to 'only system'"
181
+
)));
182
+
}
183
+
PythonPreference::Managed
184
+
| PythonPreference::OnlyManaged
185
+
| PythonPreference::System => {}
186
+
}
187
+
188
+
if !client_builder.connectivity.is_online(){
189
+
returnErr(err.with_missing_python_hint(format!(
190
+
"A managed Python download is available for request `{request}`, but uv is set to offline mode"
191
+
)));
192
+
}
193
+
194
+
returnErr(err);
195
+
}
196
+
197
+
Self::fetch(
198
+
download,
135
199
client_builder,
136
200
cache,
137
201
reporter,
138
202
python_install_mirror,
139
203
pypy_install_mirror,
140
-
python_downloads_json_url,
141
204
preview,
142
205
)
143
206
.await
144
-
{
145
-
Ok(installation) => Ok(installation),
146
-
// Throw the original error if we couldn't find a download
0 commit comments