File tree 3 files changed +17
-1
lines changed
pythonEnvironments/creation/provider
3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -161,12 +161,17 @@ def main(argv: Optional[Sequence[str]] = None) -> None:
161
161
venv_installed = is_installed ("venv" )
162
162
pip_installed = is_installed ("pip" )
163
163
ensure_pip_installed = is_installed ("ensurepip" )
164
+ distutils_installed = is_installed ("distutils" )
164
165
165
166
if not venv_installed :
166
167
if sys .platform == "win32" :
167
168
raise VenvError ("CREATE_VENV.VENV_NOT_FOUND" )
168
169
else :
169
170
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" )
170
175
171
176
if venv_exists (args .name ):
172
177
# 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';
29
29
const INSTALL_PIP_FAILED_MARKER = 'CREATE_VENV.INSTALL_PIP_FAILED' ;
30
30
const DOWNLOADING_PIP_MARKER = 'CREATE_VENV.DOWNLOADING_PIP' ;
31
31
const DOWNLOAD_PIP_FAILED_MARKER = 'CREATE_VENV.DOWNLOAD_PIP_FAILED' ;
32
+ const DISTUTILS_NOT_INSTALLED_MARKER = 'CREATE_VENV.DISTUTILS_NOT_INSTALLED' ;
32
33
33
34
export class VenvProgressAndTelemetry {
34
35
private readonly processed = new Set < string > ( ) ;
@@ -88,6 +89,16 @@ export class VenvProgressAndTelemetry {
88
89
return PIP_NOT_INSTALLED_MARKER ;
89
90
} ,
90
91
] ,
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
+ ] ,
91
102
[
92
103
VENV_NOT_INSTALLED_MARKER ,
93
104
( _progress : CreateEnvironmentProgress ) => {
Original file line number Diff line number Diff line change @@ -2057,7 +2057,7 @@ export interface IEventNamePropertyMapping {
2057
2057
*/
2058
2058
[ EventName . ENVIRONMENT_FAILED ] : {
2059
2059
environmentType : 'venv' | 'conda' | 'microvenv' ;
2060
- reason : 'noVenv' | 'noPip' | 'other' ;
2060
+ reason : 'noVenv' | 'noPip' | 'noDistUtils' | ' other';
2061
2061
} ;
2062
2062
/**
2063
2063
* Telemetry event sent before installing packages.
You can’t perform that action at this time.
0 commit comments