File tree Expand file tree Collapse file tree
pythonEnvironments/creation/provider Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,12 +161,17 @@ def main(argv: Optional[Sequence[str]] = None) -> None:
161161 venv_installed = is_installed ("venv" )
162162 pip_installed = is_installed ("pip" )
163163 ensure_pip_installed = is_installed ("ensurepip" )
164+ distutils_installed = is_installed ("distutils" )
164165
165166 if not venv_installed :
166167 if sys .platform == "win32" :
167168 raise VenvError ("CREATE_VENV.VENV_NOT_FOUND" )
168169 else :
169170 use_micro_venv = True
171+ if not distutils_installed :
172+ print ("Install `python3-distutils` package or equivalent for your OS." )
173+ print ("On Debian/Ubuntu: `sudo apt install python3-distutils`" )
174+ raise VenvError ("CREATE_VENV.DISTUTILS_NOT_INSTALLED" )
170175
171176 if venv_exists (args .name ):
172177 # A virtual environment with same name exists.
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ const INSTALLING_PIP_MARKER = 'CREATE_VENV.INSTALLING_PIP';
2929const INSTALL_PIP_FAILED_MARKER = 'CREATE_VENV.INSTALL_PIP_FAILED' ;
3030const DOWNLOADING_PIP_MARKER = 'CREATE_VENV.DOWNLOADING_PIP' ;
3131const DOWNLOAD_PIP_FAILED_MARKER = 'CREATE_VENV.DOWNLOAD_PIP_FAILED' ;
32+ const DISTUTILS_NOT_INSTALLED_MARKER = 'CREATE_VENV.DISTUTILS_NOT_INSTALLED' ;
3233
3334export class VenvProgressAndTelemetry {
3435 private readonly processed = new Set < string > ( ) ;
@@ -88,6 +89,16 @@ export class VenvProgressAndTelemetry {
8889 return PIP_NOT_INSTALLED_MARKER ;
8990 } ,
9091 ] ,
92+ [
93+ DISTUTILS_NOT_INSTALLED_MARKER ,
94+ ( _progress : CreateEnvironmentProgress ) => {
95+ sendTelemetryEvent ( EventName . ENVIRONMENT_FAILED , undefined , {
96+ environmentType : 'venv' ,
97+ reason : 'noDistUtils' ,
98+ } ) ;
99+ return VENV_NOT_INSTALLED_MARKER ;
100+ } ,
101+ ] ,
91102 [
92103 VENV_NOT_INSTALLED_MARKER ,
93104 ( _progress : CreateEnvironmentProgress ) => {
Original file line number Diff line number Diff line change @@ -2057,7 +2057,7 @@ export interface IEventNamePropertyMapping {
20572057 */
20582058 [ EventName . ENVIRONMENT_FAILED ] : {
20592059 environmentType : 'venv' | 'conda' | 'microvenv' ;
2060- reason : 'noVenv' | 'noPip' | 'other' ;
2060+ reason : 'noVenv' | 'noPip' | 'noDistUtils' | ' other';
20612061 } ;
20622062 /**
20632063 * Telemetry event sent before installing packages.
You can’t perform that action at this time.
0 commit comments