@@ -57,12 +57,32 @@ def rust_features(ext=True, binding=Binding.PyO3):
57
57
raise DistutilsPlatformError (f"unknown Rust binding: '{ binding } '" )
58
58
59
59
60
- def get_rust_version ():
60
+ def get_rust_version (min_version = None ):
61
61
try :
62
62
output = subprocess .check_output (["rustc" , "-V" ]).decode ("latin-1" )
63
63
return semantic_version .Version (output .split (" " )[1 ], partial = True )
64
64
except (subprocess .CalledProcessError , OSError ):
65
- raise DistutilsPlatformError ("can't find Rust compiler" )
65
+ raise DistutilsPlatformError (
66
+ "can't find Rust compiler\n \n "
67
+ "If you are using an outdated pip version, it is possible a "
68
+ "prebuilt wheel is available for this package but pip is not able "
69
+ "to install from it. Installing from the wheel would avoid the "
70
+ "need for a Rust compiler.\n \n "
71
+ "To update pip, run:\n \n "
72
+ " pip install --upgrade pip\n \n "
73
+ "and then retry package installation.\n \n "
74
+ "If you did intend to build this package from source, try "
75
+ "installing a Rust compiler from your system package manager and "
76
+ "ensure it is on the PATH during installation. Alternatively, "
77
+ "rustup (available at https://rustup.rs) is the recommended way "
78
+ "to download and update the Rust compiler toolchain."
79
+ + (
80
+
81
+ f"\n \n This package requires Rust { min_version } ."
82
+ if min_version is not None
83
+ else ""
84
+ )
85
+ )
66
86
except Exception as exc :
67
87
raise DistutilsPlatformError (f"can't get rustc version: { str (exc )} " )
68
88
0 commit comments