From 9e9fac2991192a08989527f15adcaa25ead8e0b3 Mon Sep 17 00:00:00 2001 From: Cory Rivera Date: Tue, 19 Jan 2021 20:01:59 -0800 Subject: [PATCH] Skip checking if python is running when only doing package upgrades during python install. (#13995) --- .../src/dialog/configurePython/configurePathPage.ts | 3 +++ .../src/dialog/configurePython/configurePythonWizard.ts | 4 +++- .../notebook/src/jupyter/jupyterServerInstallation.ts | 7 ++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/extensions/notebook/src/dialog/configurePython/configurePathPage.ts b/extensions/notebook/src/dialog/configurePython/configurePathPage.ts index 18401e309b..b865d1c86d 100644 --- a/extensions/notebook/src/dialog/configurePython/configurePathPage.ts +++ b/extensions/notebook/src/dialog/configurePython/configurePathPage.ts @@ -151,6 +151,9 @@ export class ConfigurePathPage extends BasePage { this.model.pythonLocation = pythonLocation; this.model.useExistingPython = !!this.existingInstallButton.checked; + this.model.packageUpgradeOnly = false; + } else { + this.model.packageUpgradeOnly = true; } return true; } diff --git a/extensions/notebook/src/dialog/configurePython/configurePythonWizard.ts b/extensions/notebook/src/dialog/configurePython/configurePythonWizard.ts index 1d0c31e27e..0e748d39b5 100644 --- a/extensions/notebook/src/dialog/configurePython/configurePythonWizard.ts +++ b/extensions/notebook/src/dialog/configurePython/configurePythonWizard.ts @@ -23,6 +23,7 @@ export interface ConfigurePythonModel { pythonPathLookup: PythonPathLookup; packagesToInstall: PythonPkgDetails[]; installation: JupyterServerInstallation; + packageUpgradeOnly: boolean; } export class ConfigurePythonWizard { @@ -164,7 +165,8 @@ export class ConfigurePythonWizard { let installSettings: PythonInstallSettings = { installPath: pythonLocation, existingPython: useExistingPython, - packages: this.model.packagesToInstall + packages: this.model.packagesToInstall, + packageUpgradeOnly: this.model.packageUpgradeOnly }; this.jupyterInstallation.startInstallProcess(false, installSettings) .then(() => { diff --git a/extensions/notebook/src/jupyter/jupyterServerInstallation.ts b/extensions/notebook/src/jupyter/jupyterServerInstallation.ts index 024c505eb3..29f0b2bad2 100644 --- a/extensions/notebook/src/jupyter/jupyterServerInstallation.ts +++ b/extensions/notebook/src/jupyter/jupyterServerInstallation.ts @@ -40,6 +40,7 @@ export interface PythonInstallSettings { installPath: string; existingPython: boolean; packages: PythonPkgDetails[]; + packageUpgradeOnly?: boolean; } export interface IJupyterServerInstallation { installCondaPackages(packages: PythonPkgDetails[], useMinVersion: boolean): Promise; @@ -372,9 +373,9 @@ export class JupyterServerInstallation implements IJupyterServerInstallation { } // Check if Python is running before attempting to overwrite the installation. - // This step is skipped when using an existing installation, since we only add - // extra packages in that case and don't modify the install itself. - if (!installSettings.existingPython) { + // This step is skipped when using an existing installation or when upgrading + // packages, since those cases wouldn't overwrite the installation. + if (!installSettings.existingPython && !installSettings.packageUpgradeOnly) { let pythonExePath = JupyterServerInstallation.getPythonExePath(installSettings.installPath, false); let isPythonRunning = await this.isPythonRunning(pythonExePath); if (isPythonRunning) {