@@ -57,9 +57,8 @@ function sortProductsInOrderForInstallation(products: Product[]) {
57
57
* @returns {string }
58
58
*/
59
59
export function getMessageForLibrariesNotInstalled ( products : Product [ ] , interpreterName ?: string ) : string {
60
+ // Even though kernelspec cannot be installed, display it so user knows what is missing.
60
61
const names = products
61
- // Ignore kernelspec as it not something that can be installed.
62
- . filter ( product => product !== Product . kernelspec )
63
62
. map ( product => ProductNames . get ( product ) )
64
63
. filter ( name => ! ! name )
65
64
. map ( name => name as string ) ;
@@ -131,15 +130,15 @@ export class JupyterInterpreterDependencyService {
131
130
_error ?: JupyterInstallError ,
132
131
token ?: CancellationToken
133
132
) : Promise < JupyterInterpreterDependencyResponse > {
134
- const productsToInstall = await this . getDependenciesNotInstalled ( interpreter , token ) ;
133
+ const missingProducts = await this . getDependenciesNotInstalled ( interpreter , token ) ;
135
134
if ( Cancellation . isCanceled ( token ) ) {
136
135
return JupyterInterpreterDependencyResponse . cancel ;
137
136
}
138
- if ( productsToInstall . length === 0 ) {
137
+ if ( missingProducts . length === 0 ) {
139
138
return JupyterInterpreterDependencyResponse . ok ;
140
139
}
141
140
142
- const message = getMessageForLibrariesNotInstalled ( productsToInstall , interpreter . displayName ) ;
141
+ const message = getMessageForLibrariesNotInstalled ( missingProducts , interpreter . displayName ) ;
143
142
144
143
sendTelemetryEvent ( Telemetry . JupyterNotInstalledErrorShown ) ;
145
144
const selection = await this . applicationShell . showErrorMessage (
@@ -155,8 +154,15 @@ export class JupyterInterpreterDependencyService {
155
154
156
155
switch ( selection ) {
157
156
case DataScience . jupyterInstall ( ) : {
157
+ // Ignore kernelspec as it not something that can be installed.
158
+ // If kernelspec isn't available, then re-install `Jupyter`.
159
+ if ( missingProducts . includes ( Product . kernelspec ) && ! missingProducts . includes ( Product . jupyter ) ) {
160
+ missingProducts . push ( Product . jupyter ) ;
161
+ }
162
+ const productsToInstall = missingProducts . filter ( product => product !== Product . kernelspec ) ;
158
163
// Install jupyter, then notebook, then others in that order.
159
164
sortProductsInOrderForInstallation ( productsToInstall ) ;
165
+
160
166
let productToInstall = productsToInstall . shift ( ) ;
161
167
const cancellatonPromise = createPromiseFromCancellation ( {
162
168
cancelAction : 'resolve' ,
0 commit comments