Improve log when distutils is missing (#10713)
See https://github.com/astral-sh/uv/issues/4204 for motivation This doesn't really reach the user experience I'd expect — i.e., we end up saying a virtual environment "does not exist" which is a little silly. However, I think improving the error messaging on interpreter queries in general should be solved separately. I did one small "general" change in https://github.com/astral-sh/uv/pull/10713/commits/89e11d022222a999a4ba8eb73397ea314a636811 — otherwise we don't show the message at all. --------- Co-authored-by: konsti <konstin@mailbox.org>
This commit is contained in:
@@ -720,8 +720,7 @@ impl Error {
|
||||
InterpreterError::Encode(_)
|
||||
| InterpreterError::Io(_)
|
||||
| InterpreterError::SpawnFailed { .. } => true,
|
||||
InterpreterError::QueryScript { path, .. }
|
||||
| InterpreterError::UnexpectedResponse { path, .. }
|
||||
InterpreterError::UnexpectedResponse { path, .. }
|
||||
| InterpreterError::StatusCode { path, .. } => {
|
||||
debug!(
|
||||
"Skipping bad interpreter at {} from {source}: {err}",
|
||||
@@ -729,6 +728,13 @@ impl Error {
|
||||
);
|
||||
false
|
||||
}
|
||||
InterpreterError::QueryScript { path, err } => {
|
||||
debug!(
|
||||
"Skipping bad interpreter at {} from {source}: {err}",
|
||||
path.display()
|
||||
);
|
||||
false
|
||||
}
|
||||
InterpreterError::NotFound(path) => {
|
||||
// If the interpreter is from an active, valid virtual environment, we should
|
||||
// fail because it's broken
|
||||
|
||||
@@ -604,6 +604,11 @@ pub enum InterpreterInfoError {
|
||||
UnsupportedPythonVersion { python_version: String },
|
||||
#[error("Python executable does not support `-I` flag. Please use Python 3.8 or newer.")]
|
||||
UnsupportedPython,
|
||||
#[error("Python installation is missing `distutils`, which is required for packaging on older Python versions. Your system may package it separately, e.g., as `python{python_major}-distutils` or `python{python_major}.{python_minor}-distutils`.")]
|
||||
MissingRequiredDistutils {
|
||||
python_major: usize,
|
||||
python_minor: usize,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
|
||||
Reference in New Issue
Block a user